Untitled
unknown
python
2 years ago
1.6 kB
5
Indexable
# Import necessary libraries import random # Set up guest list guests = ['Homer', 'Marge', 'Bart', 'Lisa', 'Maggie', 'Ned', 'Maude', 'Rod', 'Todd'] # Generate random number for number of guests attending num_attendees = random.randint(1, len(guests)) # Print number of attendees print(f"{num_attendees} guests will be attending the party.") # Choose a random location for the party locations = ['Simpson House', 'Krusty Burger', 'Kwik-E-Mart', 'Moe\'s Tavern'] location = random.choice(locations) # Print the location print(f"The party will be held at {location}.") # Set up menu menu = {'Pizza': 8.99, 'Hamburgers': 7.99, 'Hot Dogs': 6.99, 'Donuts': 1.99} # Generate a random number of menu items num_items = random.randint(1, len(menu)) # Print the menu items print(f"The following {num_items} items will be available on the menu:") # Choose random menu items menu_items = random.sample(list(menu.keys()), num_items) # Print the chosen menu items and their prices for item in menu_items: print(f"{item}: ${menu[item]}") # Generate a random number of balloons num_balloons = random.randint(10, 50) # Print the number of balloons print(f"{num_balloons} balloons will be used to decorate the party.") # Choose a random party game party_games = ['Pin the Tail on the Donkey', 'Musical Chairs', 'Twister', 'Piñata'] game = random.choice(party_games) # Print the chosen party game print(f"The party game will be {game}.") # Print a closing message print("Happy Birthday! Let's have some fun!")
Editor is loading...