#Dictionary of Days and their Temperature
#defining an empty dictionary to add days and their temperature
d={}
#defining a list of name of days
days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
#take entry of temperature from user
for i in days:
temp=int(input("enter temperature of "+i+" :"))
d[i]=temp
#to display the day and its temperature in the form of dictionary
print('DAY & TEMPERATURE')
print(d)
#find maximum temperature
tmax=max(d.values())
print('maximum temperature' , tmax)
OUTPUT:
#defining an empty dictionary to add days and their temperature
d={}
#defining a list of name of days
days=['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday']
#take entry of temperature from user
for i in days:
temp=int(input("enter temperature of "+i+" :"))
d[i]=temp
#to display the day and its temperature in the form of dictionary
print('DAY & TEMPERATURE')
print(d)
#find maximum temperature
tmax=max(d.values())
print('maximum temperature' , tmax)
OUTPUT:
No comments:
Post a Comment