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 my_func(a): c = len(a) while c > 0: if c < 5: print('NO') break elif c >= 5: print('YES') break c -= 1 my_func('A')

Questions about programming?Chat with your personal AI assistant