Temperature Report
Python
25 pts
Temperature Report
These are the highest temperatures (°C) in Massawa for six days. Use list comprehensions to create:
hot_days— only the temperatures above 30.labels— for every day,"hot"if the temperature is above 30, else"ok".doubled— every temperature multiplied by 2.
Print the three lists. Expected output:
[31, 36, 40] ['ok', 'ok', 'hot', 'hot', 'ok', 'hot'] [36, 50, 62, 72, 44, 80]
Checklist
- Keep the list
tempsunchanged. - Create
hot_dayswith only the temperatures above 30. - Create
labelswith"hot"or"ok"for every day. - Create
doubledwith every temperature multiplied by 2. - Print the three lists.
🔑 Solution
If you view the solution before passing, you earn half points for this exercise. You still need to type it and press Check to finish.
How it works, step by step
Point at a step to highlight its lines. Type the solution yourself and press Check answer to finish.
