This is a draft cheat sheet. It is a work in progress and is not finished yet.
Types of Variables
number |
used to represent an amount |
string |
multiple characters |
list |
an ordered list of items |
tuple |
an immutable list |
dictionary |
a key value pair system |
Numbers
int |
integers, whole numbers (3, -2, 7) |
float |
floating point numbers, non-whole numbers (3.14, -1.6, 4.0) |
long |
very large numbers (987654L, 3.2e10L) |
complex |
complex numbers (3+5j) |
|
bool |
booleans, a subclass of int, either True or False |
|
|
Assigning Variables
x = 5 |
a simple assignment |
x = 3 |
variables can be reassigned |
x = y = 3 |
shorthand for x = 3 and y = 3 |
x, y = 7, 9 |
shorthand for x = 7, y = 9 |
|
|
|