Addition, substraction, multiplication
1+1 3-2 6*6
Division
regular, modulo, remainder
22/7 22//7 22%7
Booleans
3 == 3 3 != 3 (1 != 1) & (1 < 1) (1 == 1) | (1 < 1)
Create lists
x = [1,2,3,4,5] y = ['a','b','c','d','e']
Assign a variable
a=7
Print object
print(a)
Get type of an object
type(9) #int
type(99.55) #float
type('a') #str
type(5+2.0) #floatWhat Matt was talking about
a=7 print(a) b=a print(b) a=5 print(b) print(a)
Define multiple objects
trois=three=tres=3 print(three) print(trois)
Verify type of an object
type(7)==int isinstance(7,int)
Basic loop
for x in range(10):
print(x)Clear console
clear(x)
Concatenate strings
x='0' y='9' xy = x + y print(xy)
Display credit
credits
Get python version (in terminal)
python -V
Append lists
x = [1,2,3,4,5] y = ['a','b','c','d','e'] x + y