Logic#
# remember booleans?
type(True)
bool
type(False)
bool
# double equals sign checks for equavalence
1 == 1
True
1 == 0
False
10 > 5
True
# single equals sign makes an assignment
variable = 'my variable'
# double equals sign checks for an equivalence
variable == 'hello'
False
age = 17
if age > 24:
print("You can rent a car")
elif age > 20:
print("You can have a beer")
print("You can also play poker")
elif age > 17:
print("You can vote")
elif age > 16:
print("You can build your credit")
else:
print("You're too young")
You can build your credit
show = 'the last of us'
if show == 'spongebob':
print('you have the wrong show')
elif show == 'survivor':
print('you have the correct show')
else:
print("I don't know what show you're talking about... I'm just a little program")
I don't know what show you're talking about... I'm just a little program