PyGame Guide/Python Crash Course
A basic program
editA simple Hello World program:
print("Hello World")
Variables
editVariables in Python are dynamically typed. This means that a variable may hold either a number, string, or any object.
variably = 40
variably = 40.9
variably = "fourty point nine"
print(variably)
# Based on the assignment above, this will print "fourty point nine"
Input and output
editIf statements
editif True:
print("This will always execute")
if 6 > 5:
print("6 is, in fact, greater than 5")
variably = False
if variably:
print("variably is True")
else:
print("variably is False")
letter = "a"
if letter == "a":
print("got option A")
elif letter == "b":
print("got option B")
elif letter == "c":
print("got option C")
else:
print("got unknown option")