Recap: Temperature Grid
Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 9 of 60.
Challenge
EasyA greenhouse sensor reads the temperature at 6, 12, 18 and 24 o'clock. readings holds one list per day, day 1 first. The program reads a day and an hour.
- Make an array
gridfromreadings. - Print the reading hours, made with
np.arange. - Print the number of days, from the shape.
- Print that hour on the last 3 days, then that day from noon on.
Hour 6 is column 0, hour 12 column 1, and so on. In another greenhouse, day 2 and hour 6 pick these cells:
and print:
Hours: [ 6 12 18 24]
Days recorded: 6
Last 3 days at 6:00: [11.5 10.5 12. ]
Day 2 from noon on: [18.5 22. 14. ]Try it yourself
import numpy as np
# Greenhouse temperatures in degrees Celsius: one row per day (days 1 to 5),
# one column per reading, taken at 6, 12, 18 and 24 o'clock
readings = [
[12.5, 21.0, 24.5, 15.0],
[13.0, 22.5, 23.5, 14.5],
[11.5, 19.0, 21.0, 13.0],
[14.0, 24.5, 26.0, 16.5],
[12.0, 20.5, 22.0, 14.0],
]
day = int(input())
hour = int(input())
# Write your code below
All lessons in Data and Plots
2NumPy Arrays
Creating ArraysShape and SizeRanges of NumbersIndexing and SlicingRecap: Temperature GridPractice on your own: Online Python compiler