I have this dictionary:
{2014: [12000, 14000], 2015: [14500, 16000], 2016: [18000, 19000], 2017: [17500, 8500], 2018: [9600, 1100]}
I need to print a list with with the 2 values like [12000, 4000]
when the user types a specific key, check if the input year is in the keys of the dictionary and this procedure stops when the user types whitespace and not a valid year.
l1 = {2014: [12000, 14000], 2015: [14500, 16000], 2016: [18000, 19000], 2017: [17500, 8500], 2018: [9600, 1100]}
list2 = []
temp_total1 = []
temp_total2 = []
for key, value in l1.items():
year = int(input("Give the Year"))
if year < 2014 and year > 2018 or year == '':
break
if year in l1:
print("There is a year in the dictionary")
temp_total1 = temp_total1.append(value[0])
temp_total2 = temp_total2.append(value[1])
list2 = zip(temp_total1, temp_total2)
else:
break