The script to which you can gradually add the code is available here: ex_01.py. The solution is available in: ex_01_solution.py.
We will discuss the following topics in the exercise:
-
Dynamic typing
-
Garbage collector
-
Working environment:
- ipython
- Magic command,% hist
-
Basic data types:
- numbers (int, long, float, complex)
- string:
- immutable
- literal for long string
- encoding (prefix u)
-
list, tuple
-
dict
-
Singletons:
None,True,False -
Syntax basics:
- Comments (+ docstring)
- Assignment to a variable
- Calling functions
- print (basic
{}substitution) - Conditions (possibility to bypass the absence of the switch)
- Cycles:
- for
- while
- Function definition
We will practice collections, file handling, the use of various function parameters, generators, etc.
The script where you can gradually add your code is available here: ex_02.py.The script for working with files is available here: ex_02_files.py. An additional file, cities.txt, is also required for this script.