Skip to content

Latest commit

 

History

History
54 lines (39 loc) · 1.3 KB

File metadata and controls

54 lines (39 loc) · 1.3 KB

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_fav_animal = "cats"
 user_fav_animal = input("What is your favorite animal? ")
 my_fav_animal == user_fav_animal

In your notebook, answer the following

  1. What does 5 < 3 evaluate to?
  2. What is the type of 5 < 3? What does that stand for?
  3. What is the difference between == and = ?
  4. What data type do you think my_fav_animal == user_fav_animal is?

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:

  1. What does and do here? What type do you think can_get_license is?
  2. 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'
animal == 'cat' or animal == 'dog'

In your notebook, add answers to the following:

  1. What does = and == do here?
  2. What is the difference between the two or statements?