Python Programming Reference Sheet
Oct 26, 2023
Basics
Types
Useful functions
Other syntax
Terminology
Reminders
Conditionals
if x == 1:
print("x is one")
else:
print("x is not one")
Lists
numbers = [7, 8, 9]
first_number = numbers[0]
numbers[2] = 11
if 11 in numbers:
print("11 is in the list!")
for n in numbers:
print(n)
Defining functions
def my_func (param1, param2):
result = param1 + param2
return result
Loops
for number in [1, 2, 3]:
print(number)
x = 0
while x < 10:
print(x)
x = x + 1
Dictionaries
numbers = {
1: "one",
2: "two"
}
print(numbers[1])
Comparisons
Useful methods
Other neat bonus stuff
Let us know what you think
Please give us feedback on this manual, so we can provide content that’s truly useful and helpful. Thanks!