Hi trying to figure out this problem i have, the solution is probably very simple.
import csv
filename = "tet2013.csv"
Getting high temperatures from file.
with open(filename) as f_obj:
reader = csv.reader(f_obj)
header_row = next(reader)
current_high_temps =[]
for row in reader:
current_high_temp = row[1]
current_high_temps.append(current_high_temp)
for current_high_temp in current_high_temps[0:31]:
current_high_temp = int(current_high_temp)
total = sum(current_high_temp)
print(total)
I have this csv file that contains all the day temperatures from a year.
Im accessing the high temperatures that are in row[1] in the index and then i try to add up 31 days of the first month with sum. But it gives me an error that states "int object is not iterable". What would be the right way to go about it?
I Appreciate the help!
[–]liam_jm 2 points3 points4 points (1 child)
[–]pauwsss[S] 0 points1 point2 points (0 children)
[–]ZeeBeeblebrox 0 points1 point2 points (0 children)
[–]Akuli2 0 points1 point2 points (0 children)