Словарь представлен в виде
Код: Выделить всё
observation = {'temperature': [85, 90, 15, 25, 90, 11, 20, 15, 25],
'dewpoint': [80, 85, 10, 20, 85, 8, 15, 15, 22],
'wind speed': [5, 10, 2, 0, 25, 30, 35, 4, 2],
'precipitation': [0, 0, 0, 2, 1, 0, 1, 0, 3]}
На данный момент у меня есть следующий код:
Код: Выделить всё
def temp_freq():
exceedances = 0
threshold = 50
for value in observation['temperature']:
if value > threshold:
exceedances += 1
return exceedances
print(f"temperature exceeded {threshold} {temp_freq(exceedances):.1f} times")
Ошибки:
NameError: имя «порог» не определено< /п>
Подробнее здесь: https://stackoverflow.com/questions/791 ... -a-certain