Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- roommate_dict = {
- 'Alice': {'age': 25, 'city': 'New York'},
- 'Bob': {'age': 27, 'city': 'Paris'},
- 'Charlie': {'age': 29, 'city': 'London'},
- 'Dan': {'age': 31, 'city': 'Berlin'},
- 'Ed': {'age': 33, 'city': 'Madrid'},
- 'Frank': {'age': 35, 'city': 'Barcelona'},
- 'George': {'age': 37, 'city': 'Rome'},
- 'Harry': {'age': 39, 'city': 'Amsterdam'},
- 'Ivan': {'age': 41, 'city': 'Stockholm'},
- 'John': {'age': 43, 'city': 'Vienna'},
- 'Kevin': {'age': 45, 'city': 'Zurich'},
- 'Linda': {'age': 47, 'city': 'Hamburg'},
- 'Mark': {'age': 49, 'city': 'Munich'},
- 'Nancy': {'age': 51, 'city': 'Frankfurt'},
- 'Olivia': {'age': 53, 'city': 'Bremen'},
- 'Peter': {'age': 55, 'city': 'Dortmund'},
- 'Quinn': {'age': 57, 'city': 'Leipzig'},
- 'Robert': {'age': 59, 'city': 'Cologne'},
- 'Sandra': {'age': 61, 'city': 'Dresden'},
- 'Tim': {'age': 63, 'city': 'Hannover'},
- 'Ulf': {'age': 65, 'city': 'Bergen'},
- 'Victor': {'age': 67, 'city': 'Aachen'},
- 'Wendy': {'age': 69, 'city': 'Frankfurt'},
- 'Xavier': {'age': 71, 'city': 'Stuttgart'},
- 'Yvonne': {'age': 73, 'city': 'Hannover'},
- 'Zoe': {'age': 75, 'city': 'Munich'}
- }
- cost = 25
- for each_roommate in (roommate_dict.keys()):
- roommate_name = set(list(roommate_dict.keys()))
- user_input = input(f'will ({each_roommate}) pay "full" or "half" this month?').casefold()
- if user_input == "half":
- roommate_dict[each_roommate]["cost"] = cost/2
- elif user_input == "full":
- roommate_dict[each_roommate] ["cost"] = cost
- else:
- print("Please enter 'half' or 'full'")
Add Comment
Please, Sign In to add comment