That's correct! I just simply added an extra "false element". Once the city variable reaches it, the program shuts down. Here's the code I came up with which is super simple, and it works:
city_array = ['1', '2', '3', '4']
city = get_next_element(city_array)
print(f"Assigned value: {city}")
if city == '4':
break