Maths Functions Flashcards
1
Q
Power Of
A
**
2
Q
Round Down
A
//
3
Q
Remainder
A
%
4
Q
Precedence
A
- before +
5
Q
Strings use escape characters
A
x = “Her name's "Elizabeth"”
6
Q
id(varName)
A
This gives the address
7
Q
type(varName)
A
This gives the type, like ‘int’
8
Q
Name 7 types
A
bool, int, float, string, tuple, list and dict
9
Q
Casting
A
varName = int(10.5)
10
Q
Multiline string
A
’’’ OR ‘’’\ The 2nd version escapes the carriage return
11
Q
Define a Tuple
A
varTuple = (1,2,3,4)
12
Q
Define a List
A
varList = [1,2,3,4)
13
Q
Define a Dict
A
varDict = {‘a’:1, ‘b’:2}
14
Q
Get items 2 and 3 from a list
A
varList[1:2]
15
Q
While
A
While a<100:
print(a)
a+=1