Computer Science, asked by pathan311576, 6 months ago

Write a program to read the 10 city name and its temperature.

Search for a city name and print the temperature of the found city else

print “City does not exist”​

Answers

Answered by Equestriadash
7

n = int(input("Enter the number of cities you'd like to enter: "))

city_dict = dict()

print()

for i in range(n):

   x = input("Enter the city name: ")

   y = input("Enter the temperature: ")

   city_dict[x] = y

   print()

print()

print("Your given details: ")

print()

print("City\t", "Temperature")

print()

for i in city_dict:

   print(i, "\t", city_dict[i])

print()

cc = input("Enter the country you'd like to search for: ")

print()

if cc in city_dict:

   print(cc, city_dict[cc])

else:

   print("City not found.")


Equestriadash: Thanks for the Brainliest! ^_^"
Answered by Anonymous
0

Answer:

n = int(input("Enter the number of cities you'd like to enter: "))

city_dict = dict()

print()

for i in range(n):

   x = input("Enter the city name: ")

   y = input("Enter the temperature: ")

   city_dict[x] = y

   print()

print()

print("Your given details: ")

print()

print("City\t", "Temperature")

print()

for i in city_dict:

   print(i, "\t", city_dict[i])

print()

cc = input("Enter the country you'd like to search for: ")

print()

if cc in city_dict:

   print(cc, city_dict[cc])

else:

   print("City not found.")

Similar questions