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_fav_animal = "cats"
user_fav_animal = input("What is your favorite animal? ")
my_fav_animal == user_fav_animal
- What does
5 < 3
evaluate to? - What is the type of
5 < 3
? What does that stand for? - What is the difference between
==
and=
? - What data type do you think
my_fav_animal == user_fav_animal
is?
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)
- What does
and
do here? What type do you thinkcan_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.
Open up the console. Type the following code into the interactive editor.
animal = 'mouse'
animal == 'cat' or 'dog'
animal == 'cat' or animal == 'dog'
- What does = and == do here?
- What is the difference between the two
or
statements?