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
Recommended for practice:
A script from the 2011/2012 academic year that also includes recursion: ex_01_extended.py. (solution: cv1_labs_extended_full.py).