Write the code to input any 5 years and the population of any city and print it on the screen.
Write the code to input any 5 years and the population of any city and print it on the screen.
9 views
1 Answers
city=dict( )
n=5
i=l while i<=n:
a=raw_input(” enter city name”)
b=raw_input(“enter population”)
city[a] =b
i=i+l print
city
Output :
enter city name Chennai
enter population 3400000
enter city name Mumbai
enter population 8900000
enter city name Bangalore
enter population 98700
enter city name Calicut
enter population 560000
enter city name Hyderabad
enter population 900000
{‘Bangalore’: ‘ 98700’/ Hyderabad’: ‘ 900000’, ‘ Chennai’: ‘ 3400000’, ‘ Mumbai’: ‘ 8900000’, ‘ Calicut’: ‘ 560000’}
9 views
Answered