Help me solve the challenge.



  • Removed countries connect a number of countries to the three largest cities of each country. The program will have the city's name on the entrance to the variable city. And your job is to find what country the city has built. If the country is successfully found, the message must be deleted:

        countries = {
            "Sweden": ["Stockholm", "Göteborg", "Malmö"],
            "Norway": ["Oslo", "Bergen", "Trondheim"],
            "England": ["London", "Birmingham", "Manchester"],
            "Germany": ["Berlin", "Hamburg", "Munich"],
            "France": ["Paris", "Marseille", "Toulouse"]
        }
    
    city = input()
    for city in countries:
        if city == countries[1]:
            print(f 'INFO: {city} is a city in {countries}')
        else:
            print(f 'ERROR: Country for {city} not found')
    



  • countries = {
        "Sweden": ["Stockholm", "Göteborg", "Malmö"],
        "Norway": ["Oslo", "Bergen", "Trondheim"],
        "England": ["London", "Birmingham", "Manchester"],
        "Germany": ["Berlin", "Hamburg", "Munich"],
        "France": ["Paris", "Marseille", "Toulouse"]
    }
    
    city = input()
    for country, cities in countries.items():
        if city in cities:
            print(f'INFO: {city} is a city in {country}')
            break
    else:
        print(f'ERROR: Country for {city} not found')
        
    


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2