#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Sep 27 10:15:48 2019

@author: blanchette
"""

temps_since_1950= [24,19,16,23,28,15,17,19,21,16,
                   25,20,17,24,29,16,18,20,22,17,
                   26,21,18,23,28,16,17,19,22,16,
                   25,19,18,26,27,12,17,19,24,18,
                   26,20,17,22,22,13,17,19,25,12,
                   25,21,16,21,23,14,17,19,21,14,
                   26,19,15,22,24,16,17,19,22,27,]

temps_1900_to_1949_far= [65,62,76,67,69,72,56,61,62,62,
                     62,72,72,61,61,71,52,61,66,72,
                     64,64,76,64,64,70,66,62,62,82,
                     64,62,72,77,66,57,61,61,61,72,
                     62,64,76,77,62,71,67,64,68,62]

print(temps_since_1950)

for i in range(len(temps_since_1950)):
    print("In year",i+1950,"the temperature was:",temps_since_1950[i])
    
              
temps_1900_to_1949_cel=[]
for temp_far in temps_1900_to_1949_far:
    temp_cel = int((temp_far-32)*5/9)
    temps_1900_to_1949_cel.append(temp_cel)

print(temps_1900_to_1949_cel)

# create combined list:
temps_1900_to_now = temps_1900_to_1949_cel[:]
temps_1900_to_now.extend(temps_since_1950)

print("Temperatures since 1900:")
print(temps_1900_to_now)

# print a plot of temperatures
for i in range (len(temps_1900_to_now)):
    print(i+1900,"x"*temps_1900_to_now[i])

    
# When is the last time it was this warm?
today_temp = temps_1900_to_now[-1]
found_warmer = False
for i in range (len(temps_1900_to_now)-2,-1,-1):
    if (temps_1900_to_now[i] >= today_temp):
        print("Last time this warm was in ",i+1900)
        found_warmer = True
        break
    
if found_warmer == False:
    print("It has never been warmer on this day")
