Do Now 2.02
Part 1
Open up the console. 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
In your Notebook, answer the following
- What does
5 < 3evaluate 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_animalis?
Part 2
Open up the console. 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)
In your Notebook, add this to your notes in your Notebook
- What does
anddo here? What type do you thinkcan_get_licenseis? - 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
Part 3
Open up the console. Type the following code into the interactive editor.
>>> animal = 'mouse'
>>> animal == 'cat' or 'dog'
In your Notebook, continue to your answers in your Notebook to the following
- What does = and == do here?
- What is the difference between the to statements?
Part 4
Open up the console. Type the following code into the interactive editor.
>>> animal = 'mouse'
>>> animal == 'cat' or animal == 'dog'
In your Notebook, continue your notes in your Notebook
- What does = and == do here?
- What is the difference between the to statements here and Part 3 statements?