Do Now: 2.03
Part 1
Open up the terminal. Type each line of the following code into the interactive editor:
>>> 5 < 3
>>> 5 > 3
>>> type(5 < 3)
>>> type(5 > 3)
>>> my_favorite_animal = "cats"
>>> user_favorite_animal = input("What is your favorite animal? ")
>>> my_favorite_animal == user_favorite_animal
What does 5 < 3
evaluate to?
What is the type of 5 < 3
? What does that stand for (should be familiar from Snap!)?
What is the difference between ==
and =
?
What data type do you think my_favorite_animal == user_favorite_animal
is?
Part 2
Open up the terminal. Type the following code into the interactive editor.
>>> months_with_driving_permit = 6
>>> age = 16
>>> can_get_license = months_with_driving_permit >= 6 and age >= 16
>>> print(can_get_license)
What does and
do here? What type do you think can_get_license
is?
Update the code to fit the new driving law: If you are over the age of 18 you don't need to have a permit. The other law still applies for people ages 16-18.