I've just started learning Python and am setting myself the challenge of trying to create practical little programs that do something. I created a dictionary with months of the year and corresponding average temperatures. I ask the user what month they'd like to choose and then display the temperature for that month.
However it seems like I am re-writing a lot of the same code, but just changing the months. Can someone advise alternate, more efficient ways of achieving this?
# This program shows the average temperature for the month you have chosen
dict = {'january': 10, 'february': 10, 'march': 12, 'april': 14, 'may': 18, 'june': 21, 'july': 25, 'august': 25, 'september': 21, 'october': 18, 'november': 14, 'december': 11,}
month = input('When are you visting Majorca? \nChoose month: ')
if month == 'january':
print ('In january the average temperature will be: ')
print (dict['january'] , 'degrees celsius')
if month == 'february':
print ('In february the average temperature will be: ')
print (dict['february'] , 'degrees celsius')