This is a draft cheat sheet. It is a work in progress and is not finished yet.
Data Types
Integer |
-256, 15 |
Float |
-253.23, 1.253e-10 |
String |
“Hello", 'Goodbye', """Multiline""" |
List |
[ value, ... ] |
Tuple |
( value, ... ) |
Dictionary |
{ key: value, ... } |
Loops
If Statement
if expression:
statements
elif expression:
statements
else:
statements
While Loop
while expression:
statements
For Loop
for var in collection:
statements
Counting For Loop
for i in range(start, end [, step]):
statements
(start is included; end is not) |
Arithmetic operators
Addition |
x+y, x+=y |
Divide |
x/y, x/=y |
Subtraction |
x-y, x-=y |
Mod |
x%y, x%=y |
Multiplication |
xy, x=y |
Exponent |
xy, x=y |
Comparison operators
Less |
x<y |
Less or equal |
x<=y |
Greater |
x>y |
Greater or equal |
x>=y |
Equal |
x==y |
Not equal |
x!=y |
|
|
|
|
|