99.2k views
1 vote
Create an empty list called resps. Using the list percent_rain, for each percent, if it is above 90, add the string ‘Bring an umbrella.’ to resps, otherwise if it is above 80, add the string ‘Good for the flowers?’ to resps, otherwise if it is above 50, add the string ‘Watch out for clouds!’ to resps, otherwise, add the string ‘Nice day!’ to resps. Note: if you’re sure you’ve got the problem right but it doesn’t pass, then check that you’ve matched up the strings exactly.

User Bart Blast
by
4.0k points

2 Answers

6 votes

Answer:

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!")

Step-by-step explanation:

User Machow
by
4.5k points
7 votes

Answer:

resps = []

percent_rain = [77, 45, 92, 83]

for percent in percent_rain:

if percent > 90:

resps.append("Bring an umbrella.")

elif percent > 80:

resps.append("Good for the flowers?")

elif percent > 50:

resps.append("Watch out for clouds!")

else:

resps.append("Nice day!")

for r in resps:

print(r)

Step-by-step explanation:

*The code is in Python.

Create an empty list called resps

Initialize a list called percent_rain with some values

Create a for loop that iterates through the percent_rain. Check each value in the percent_rain and add the required strings to the resps using append method

Create another for loop that iterates throgh the resps and print the values so that you can see if your program is correct or not

User Jordan Mackie
by
4.1k points