Home > Net >  Nested for loops to calculate max. temperature from a csv
Nested for loops to calculate max. temperature from a csv

Time:01-14

I'm starting a class on advanced data structures and I'm struggling to answer the problems shown in the image below.The NYC_temperature.csv has hourly temperatures and you have to calculate it by day to then show what was the warmest 30-day period

The Problems I have to solve

CodePudding user response:

for i in range(len(data)-24*30-1):
    temp = 0
    for j in range(i, i 30):
        temp  = data[j]
    maxtemp = max(temp, maxtemp)
  •  Tags:  
  • Related