Click above image to access the interactive version of this notebook
Python in Practice
- In the previous modules, we learnt about python’s built-in ‘simple’ types. In this module, we will learn about the different ways in which the data of those types can be organized, so that it can be used (algorithmically) efficiently.
we have already covered
str
,int
,float
, andcomplex
. Here, we will also introduce the remaining two –bool
andNone
python’s built-in types
-
We will also take a look at how to reduce code duplication and improve code readability by using Functions.
-
Finally we will look at Exception Handling in which we will learn about ways of making our code handle the errors without crashing.
Data Structures
Python’s most basic data structure is the sequence
. Each element of a sequence is assigned a number known as index number. Different types of sequences in Python are:
List
Tuple
Range
- Text sequence types e.g.
str
- Binary sequence types e.g.
bytearray
,buffer
Python has several built-in data structures (or compound types) that act as containers and hold the other types. They are:
- List
- Tuples
- Sets
- Dictionaries