1.1 Brackets, ‘:’ ‘=’ and ‘==’

1.1.1 Brackets

Use Example
() Maths (1+2)*5
Functions print('Hello!')
[] Lists, Arrays my_list[1:4]
{} Dictionary my_dict = {'Names':['A','B','C'] ,'Age':['1','2','3']}

1.1.2 Colon (:)

Use Example Comment
Splicing my_list[1:4:5] my_list[m:n] gives m-n elements.
my_list[:,3] Represents all in the index
Start of scope def fun(x,y): : indicates the start of the statment of def, for, while,…

1.1.3 Equal Signs (=)

Use Example Comment
= Assignment x = 5
== Boolean test x == 5 Asking the question
“Is x equal to 5?”
x = x + c Update a variable using its current value. x = 1
x = x + 10
(The value of x is now 11)
The RHS is always evaluated first and then made equal to the LHS.
+= Augmented assignment x = 1
x += 10
(The value of x is now 11)
Usually has the same effect as x = x + c.
is() Test of Identity x is y Asking the question
“Does x have the same id as y?”