-
-
Save mayankdawar/f51adcde0f8c0f85440fc4e88ce7da13 to your computer and use it in GitHub Desktop.
percent_rain = [94.3, 45, 100, 78, 16, 5.3, 79, 86] | |
resps = [] | |
for i in percent_rain: | |
if i > 90: | |
resps.append("Bring an umbrella.") | |
elif i >80: | |
resps.append("Good for the flowers?") | |
elif i > 50: | |
resps.append("Watch out for clouds!") | |
else: | |
resps.append("Nice day!") |
percent_rain = [94.3, 45, 100, 78, 16, 5.3, 79, 86]
resps = []
for i in percent_rain:
if i > 90:
resps += ['Bring an umbrella.']
elif i > 80:
resps += ['Good for the flowers?']
elif i > 50:
resps += ['Watch out for clouds!']
else:
resps += ['Nice day!']
print(resps)
this one works. but make sure that your output is same as the expected output. I forgot one fullstop and it show failed.
percent_rain = [94.3, 45, 100, 78, 16, 5.3, 79, 86]
resps = []
for i in percent_rain:
if i > 90:
resps += ['Bring an umbrella.']
elif i > 80:
resps += ['Good for the flowers?']
elif i > 50:
resps += ['Watch out for clouds!']
else:
resps +=['Nice day!']
print(resps)
percent_rain = [94.3, 45, 100, 78, 16, 5.3, 79, 86]
resps = []
for i in percent_rain:
if i > 90:
resps += ['Bring an umbrella.']elif i > 80: resps += ['Good for the flowers?'] elif i > 50: resps += ['Watch out for clouds!'] else: resps +=['Nice day!'] print(resps)
This works 100%
I tried this but it did not work; not sure what is wrong
percent_rain = [94.3, 45, 100, 78, 16, 5.3, 79, 86]
resp =[]
if percent_rain < 90:
resp = ("bring an umbrella")
output (resp)
elif percent_rain > 80:
output (resp + ("Good for the flowers?"))
elif percent_rain<50:
output (resp +("Wacth out for clouds"))
else :
output (resp +("Nice day!"))
percent_rain = [94.3, 45, 100, 78, 16, 5.3, 79, 86]
resps = []
for i in percent_rain:
if i > 90:
resps += ['Bring an umbrella.']
elif i > 80:
resps += ['Good for the flowers?']
elif i > 50:
resps += ['Watch out for clouds!']
else:
resps += ['Nice day!']
print(resps)