Computer Science, asked by immortal1708, 5 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”

PLS ANSWER FASTTTTTTTTTT​

Answers

Answered by keyboardavro
1

Answer:

Explanation:

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