Chapter 1 - Starter & Data Structures
📖 You can run the first practical here or download it there.
⚠️ In case you directly run it on the net, do save your work locally on your machines, otherwise it will be lost!
Notions:
- general data structures (list, tuple, set, dictionary)
- mutable and immutable types
- hashable type
- comprehension (on list, set and dictionaries)
- numerical sequence
- dichotomous research
As a reminder:
Tuple
A tuple is an immutable array data structure in Python with the following characteristics:
- can hold any type of data
- can hold different types of data at the same time
- can not be modified We can generate tuples using curve brackets.
List
A list is a second structure that allows to store heterogeneous elements (of different types, i.e. integers, strings,…) They are mutable, that is to say it is possible to modify one element, to add or even to remove one without defining the whole list itself (contrary to tuples).
⚠️ One point we have to be careful with: to copy a list, we must use the copy
method (which create not only a new variable but also allocate a new proper memory space).