Menu
CoddyTech

Recap: Temperature Grid

Part of the Data and Plots section of Coddy's Machine Learning journey. Lesson 9 of 60.

challenge icon

Challenge

Easy

A 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.

  1. Make an array grid from readings.
  2. Print the reading hours, made with np.arange.
  3. Print the number of days, from the shape.
  4. 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:

A grid of 6 days by 4 reading times, 6:00 to 24:00. Shaded: day 2 at 12:00, 18:00 and 24:00, and days 4 to 6 at 6:00

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

Practice on your own: Online Python compiler