This repository contains a collection of materials for teaching/learning Python 3 (3.5+).
- Use Google Colab Notebooks to follow codidng examples.
If you can not access Google Colab Notebook, you can still follow the web based materials. However, you should be able to use Colab Notebook in order to complete the exercises.
- Clone or download this repository onto your Google Drive.
- Open Google colab notebooks on Google Dirve via Chrome browser.
- Google Colab session will open in the browser and you can start navigating through the materials.
See contributing guide.
import this
The Zen of Python, by Tim Peters
- Beautiful is better than ugly.
- Explicit is better than implicit.
- Simple is better than complex.
- Complex is better than complicated.
- Flat is better than nested.
- Sparse is better than dense.
- Readability counts.
- Special cases aren't special enough to break the rules.
- Although practicality beats purity.
- Errors should never pass silently.
- Unless explicitly silenced.
- In the face of ambiguity, refuse the temptation to guess.
- There should be one-- and preferably only one --obvious way to do it.
- Although that way may not be obvious at first unless you're Dutch.
- Now is better than never.
- Although never is often better than right now.
- If the implementation is hard to explain, it's a bad idea.
- If the implementation is easy to explain, it may be a good idea.
- Namespaces are one honking great idea -- let's do more of those!
- Strings [notebook] [exercise]
- Numbers [notebook] [exercise]
- Conditionals [notebook] [exercise]
- Lists [notebook] [exercise]
- Dictionaries [notebook] [exercise]
- For loops [notebook] [exercise]
- Functions [notebook] [exercise]
- Testing with pytest - part 1 [notebook] [exercise]
- Recap exercise 1 [exercise]
- File I\O [notebook] [exercise]
- Classes [notebook] [exercise]
- Exceptions [notebook] [exercise]
- Modules and packages [notebook]
- Debugging [notebook] [exercise]
- Goodies of the Standard Library - part 1 [notebook] [exercise]
- Testing with pytest - part 2 [notebook] [exercise]
- Virtual environment [notebook]
- Project structure [notebook]
- Recap exercise 2 [exercise]
Python is a powerful language which contains many features not presented in most other programming languages. Idiomatic section will cover some of these Pythonic features in detail. These materials are especially useful for people with background in other programming languages.
- Idiomatic loops [notebook]
- Idiomatic dictionaries [notebook]
- Idiomatic Python - miscellaneous part 1 [notebook]
- Idiomatic Python - miscellaneous part 2 [notebook]
- Idiomatic Python exercise [exercise]
- Efficient use of fixtures [notebook]
- Other tips and tricks
A list of best development practices for Python projects. Most of the practices listed here are also applicable for other languages, however the presented tooling focuses mainly on Python.
- Sets
- Generators
- Decorators
- Context managers
- Playing with attributes
- *, *args, **kwargs
- Command line arguments with click
- OOP - inheritance
- OOP - Abstract Base Classes
- OOP - attrs
- Testing with mocks
- Structuring your tests
- requests
- testing requests with responses
- beautifulsoup4
- selenium
- SQLAlchemy
- excel
- openpyxl
- pdf
- pdfrw / PyPDF2