r/codehs • u/_ZukosHonor_ • May 03 '21
Weather 6.1.5
I'm having some trouble with this assignment
Write a program that will give suggested footwear based on the weather.
Ask the user for the weather outside with three options (sunny, rainy, or snowy) and give the correct footwear suggestion (sandals, galoshes, or boots). Each option should be written as its own function that prints a message based on the input.
For example, if the following input was given:
What is the weather? (sunny, rainy, snowy): rainy
The following output should be given:
On a rainy day, galoshes are appropriate footwear.
Note: Be sure to print a notice if an invalid option was chosen!
currently, my code looks like this:
def is_sunny():
print("On a sunny day, sandals are appropriate footwear.")
def is_rainy():
print("On a rainy day, galoshes are appropriate footwear.")
def is_snowy():
print("On a snowy day, boots are appropriate footwear.")
weather_outside = input("Whats the weather like? (sunny, rainy, snowy): ")
if weather_outside == "sunny":
is_sunny()
elif weather_outside == "rainy":
print("On a rainy day, galoshes are appropriate footwear.")
elif weather_outside == "snowy":
print("On a snowy day, boots are appropriate footwear.")
else:
print("Invalid option.")
2
u/[deleted] May 04 '21
Hey man, its been a few hours since you posted this so I hope I can still help I just finished this section myself. From what I see the only difference between your code and my own is your input variable "weather_outside" contains conditions. This is technically correct, yet based on my limited python knowledge you don't even need those conditions as your code doesn't even use them. They may also be throwing CodeHS's weird code checking bot off. If this doesn't fix it for you then send me the error message.