Python uses an object's truth value when an expression appears in a conditional or logical position. For user input, an empty string is false, so `if not city_name` means “if the city name is empty.” section 4.9
Stopping on empty input
A rainfall collector can repeatedly ask for a city and stop when the user submits an empty response: ```python while True: city_name = input("City: ") if not city_name: break mm_rain = int(input("Enter mm rain: ")) rainfall[city_name] = rainfall.get(city_name, 0) + mm_rain ``` The `not` operator reverses the string's Boolean value: a nonempty city name continues the loop, while an empty one exits it. section 4.9

