write a program in Python to store the name of five cities list create a function search name to search city using Linear search if the required name was and name it is not available the function should return -1
cities = ['Moscow', 'New York', 'Ekaterinburg', 'Tokyo', 'Berlin']
def search_city(name):
for city in cities:
if city.lower() == name.lower():
return True
return -1
name = input()
print(search_city(name))
Comments
Leave a comment