Project
Weekly weather with NumPy
Store a week of temperatures in a NumPy array and find averages, extremes and hot days.
- Read seven temperatures on one line separated by spaces, store them in a NumPy array called
temps, and printAverage:followed by the mean rounded to 1 decimal place. - Add
Hottest:andColdest:lines with the maximum and minimum temperatures (as they come from the array, for example36.0). - Use a Boolean mask to count the days warmer than the average, and print
Days above average:followed by that count.
Line 1, column 1Tab indents 4 spaces. Press Esc then Tab to leave the editor.