generate functionWed, 01 Mar 2023

A list of city names is entered in one line separated by a space. Determine that all cities in this list are more than 5 characters long. Implement the program using a while loop and a break statement. Print YES if the condition is met and NO otherwise.

def city_check(cities): cities = cities.split() while True: if all(len(city) > 5 for city in cities): print("YES") break else: print("NO") break city_check("Kyiv Dnipro Kharkiv")

Questions about programming?Chat with your personal AI assistant