Advertisement
OverSkillers

TemperaturaFicheiro

Dec 6th, 2017
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. import matplotlib.pyplot as plt
  2.  
  3. #Exercício T.5
  4.  
  5. def temp_max_min(f_ent):
  6.     f_in = open(f_ent,'r')
  7.     dados = []
  8.     cidade = f_in.readline()
  9.     while cidade !='':
  10.         dados.append([float(valor) for valor in cidade[:-1].split()])
  11.         cidade = f_in.readline()
  12.     return dados
  13.     #calcula maximo e minimo
  14.     print('dados \n',dados)
  15.     lista_valores_mes = lista(zip(*dados))
  16.     print('\n Lista de valores', lista_valores_mes)
  17.    
  18.     #calculamaximos
  19.     maximos = [max(mes) for mes in lista_valores_mes)
  20.     #calculaminimos
  21.     minimos = [min(mes) for mes in lista_valores_mes)
  22.     #mostra resultado
  23.     plt.figure(1)
  24.     plt.figure(maximos)
  25.     plt.figure(minimos)
  26.     plt.show()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement