whoops indent* this happens when you have 4 hours sleep
def number_of_polluted_days(januar): k = {} print('if you used sum(pollution) what are you really summing?') for day, data in januar.items(): print('Day:',day) for city, pollution in data.items(): #d = ['Texas', 'Moscow', 'Berlin', 'Athens'] if city not in k: k[city]=0 if city in k: k[city] += 1 print(city,pollution) #if you use sum(pollution) #how far did you indent this avg? Depending on the indent might get looped #avg[city]= sum(pollution)/float(len(pollution)) #avg[city]= sum(pollution)/float(len(pollution)) #avg[city]= sum(pollution)/float(len(pollution)) print(k) #Shows the number of time a city appears. return k januar = { 1: {'Texas': 126, 'Moscow': 64, 'Berlin': 57, 'Athens': 35,}, 2: {'Texas': 53, 'Moscow': 56, 'Berlin': 58,}, 3: {'Texas': 34, 'Moscow': 71, 'Berlin': 48, 'Athens': 55,} } number_of_polluted_days(januar)
When my code doesn't work I don't know why **think** and when my code works I don't know why **think**