weather = "sunny"
transportation = "available"
boots = "present"
coat = "has holes :/"
print("The weather is " + weather)
print("Your transportation is " + transportation)
print("Your boots are " + boots)
print("your coat " + coat)
if weather == "sunny":
if transportation == "available":
if boots == "present":
if coat == "mended":
print("You are ready to go hiking!")
else:
print("You need to sew it. ")
else:
print("You need to find your boots first.")
else:
print("You need to arrange transportation.")
else:
print("It's not good weather for hiking.")
The weather is sunny
Your transportation is available
Your boots are present
your coat has holes :/
You need to sew it.
Popcorn Hack #2
- Try changing some of the defined booleans and see what values you get!!
living_room_available = True
projector_working = True
enough_snacks = True
if living_room_available:
if projector_working:
if enough_snacks:
print("You're ready to host the movie!")
else:
print("You need to get more snacks. Ideas: Popcorn, Candy, Soda")
else:
print("fix projecter")
else:
print("find a new location!")
You're ready to host the movie!
HOMEWORK HACK #1
weather = "sunny"
sunscreen = "full"
snacks = "no snacks"
print("The weather is " + weather)
print("Your suncreen is " + sunscreen)
print("You have " + snacks)
if weather == "sunny":
if sunscreen == "full":
if snacks == "enough snacks":
print("You are ready to go hiking!")
else:
print("You need to go get more snackies.")
else:
print("You need to buy new sunscreen.")
else:
print("It's not good weather for hiking.")
The weather is sunny
Your suncreen is full
You have no snacks
You need to go get more snackies.
# Variables to store user's age, home space, and availability
age = int(input("Enter your age: "))
home_space = float(input("Enter the space in your home (in square feet): "))
available_to_care = input("Are you available to take care of the pet? (yes/no): ").lower() == "yes"
# Check if the conditions for adopting a pet are met
if age < 18:
print("You must be at least 18 to adopt a pet.")
elif home_space <= 50:
print("You need a bigger home to adopt a pet.")
elif not available_to_care:
print("You need to make time to take care of the pet.")
else:
print("You can adopt the pet!")
You can adopt the pet!
HW Hack #3
# Variables to store the conditions
weather_clear = input("Is the weather clear? (yes/no): ").lower() == "yes"
has_running_shoes = input("Do you have running shoes? (yes/no): ").lower() == "yes"
practice_days = int(input("How many days have you practiced?: "))
# Check the conditions for participating in the marathon
if not weather_clear:
print("It's not the right time for the marathon due to the weather.")
elif not has_running_shoes:
print("You need to buy shoes first.")
elif practice_days < 10:
print("You need to practice more.")
else:
print("You are ready for the marathon!")
You are ready for the marathon!
Python Quiz
1.) B; you need permission to enter
2.) B; x is positive but y is not
3.) C; Its too cold.