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