name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "name"
organizer=input("Enter organizer name: ")# Prompt the user for input and assign it to the variable "organizer"
description=input("Enter event description: ")# Prompt the user for input and assign it to the variable "description"
event=self.event_factory.create_event(name,organizer,description)# Create an Event object using the "event_factory" instance variable and the input from the user
self.events.append(event)# Add the newly created event object to the list stored in the "events" instance variable
print(f"Event {name} created successfully!")# Print a message confirming the event has been created
event=self.event_factory.create_event(name,organizer,description)# Create an Event object using the "event_factory" instance variable and the input from the user
self.events.append(event)# Add the newly created event object to the list stored in the "events" instance variable
print(f"Event {name} created successfully!")# Print a message confirming the event has been created
defaddPlusOne(self,event_name):
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the parameter "event_name" or return None
ifevent:
name=input("\nEnter Plus one invitee name: ")# Prompt the user for input and assign it to the variable "name"
rsvp=input("Has Plus one invitee RSVPd? (y/n)").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
rsvp=input("Has Plus one invitee RSVPd? (y/n) *Pressing enter to skips will be considered <No>").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
dietary_req=input("Enter invitee dietary requirements: ")# Prompt the user for input and assign it to the variable "dietary_req"
invitee=self.event_factory.create_invitee(name,rsvp,False,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user, with the plus_one attribute set to true
event.add_invitee(invitee)# Add the newly created invitee object to the list of invitees of the event
print(f"Invitee {name} added to event {event_name} as plus One")# Print a message confirming the invitee has been added as plus one
ifname.strip()==""ordietary_req.strip()=="":
print("Please provide all values. Try Again")
else:
invitee=self.event_factory.create_invitee(name,rsvp,False,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user, with the plus_one attribute set to true
event.add_invitee(invitee)# Add the newly created invitee object to the list of invitees of the event
print(f"Invitee {name} added to event {event_name} as plus One")# Print a message confirming the invitee has been added as plus one
else:
print(f"Event {event_name} not found.")# Print an error message if the event is not found
defadd_invitee(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
ifevent:
name=input("Enter invitee name: ")# Prompt the user for input and assign it to the variable "name"
rsvp=input("Has invitee RSVPd? (y/n)").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
dietary_req=input("Enter invitee dietary requirements: ")# Prompt the user for input and assign it to the variable "dietary_req"
plus_one=input("Is invitee bringing a plus one? (y/n)").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "plus_one"
ifplus_one:
self.addPlusOne(event_name)# If the invitee is bringing a plus one, call the addPlusOne method and pass the event_name
invitee=self.event_factory.create_invitee(name,rsvp,plus_one,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user
event.add_invitee(invitee)# Add the newly created invitee object to the list of invitees of the event
print(f"Invitee {name} added to event {event_name}")# Print a message confirming the invitee has been added
ifevent_name.strip()=="":
print("Please provide a proper event name")
else:
print(f"Event {event_name} not found.")# Print an error message if the event is not found
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
ifevent:
name=input("Enter invitee name: ")# Prompt the user for input and assign it to the variable "name"
rsvp=input("Has invitee RSVPd? (y/n) *Pressing enter to skip will be considered <No>").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "rsvp"
dietary_req=input("Enter invitee dietary requirements: ")# Prompt the user for input and assign it to the variable "dietary_req"
plus_one=input("Is invitee bringing a plus one? (y/n) *Pressing enter to skips will be considered <No> ").lower()=="y"# Prompt the user for input, convert it to lowercase, and check if it is equal to "y" and assign the boolean value to "plus_one"
ifname.strip()==""ordietary_req.strip()=="":
print("Please provide all values")
else:
ifplus_one:
self.addPlusOne(event_name)# If the invitee is bringing a plus one, call the addPlusOne method and pass the event_name
invitee=self.event_factory.create_invitee(name,rsvp,plus_one,dietary_req)# Create an Invitee object using the "event_factory" instance variable and the input from the user
event.add_invitee(invitee)# Add the newly created invitee object to the list of invitees of the event
print(f"Invitee {name} added to event {event_name}")# Print a message confirming the invitee has been added
else:
print(f"Event {event_name} not found.")# Print an error message if the event is not found
defview_invitees(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
ifevent:
event.view_invitees()# call the view_invitees method on the event object
ifevent_name.strip()=="":
print("Please provide a proper event name")
else:
print(f"Event {event_name} not found.")# Print an error message if the event is not found
event=next((xforxinself.eventsifx.name==event_name),None)# Iterate through the list stored in the instance variable "events" and return the first event object whose "name" attribute matches the input event_name or return None
ifevent:
event.view_invitees()# call the view_invitees method on the event object
else:
print(f"Event {event_name} not found.")# Print an error message if the event is not found
defadd_menu_item(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
print(f"Event {event_name} not found.")# Print an error message if the event is not found
defsearch_invitee(self):
invitee_name=input("Enter invitee name: ")# Prompt the user for input and assign it to the variable "invitee_name"
foreventinself.events:# Iterate through the list stored in the instance variable "events"
invitee=next((xforxinevent.inviteesifx.name==invitee_name),None)# Iterate through the list of invitees of the event and return the first invitee object whose "name" attribute matches the input invitee_name or return None
ifinvitee:
print(f"Invitee {invitee_name} found in event {event.name}")# Print a message with the event name where the invitee is found
print(f"RSVP: {invitee.rsvp}")# Print the invitee RSVP status
print(f"Plus One: {invitee.plus_one}")# Print the invitee plus one status
print(f"Dietary Requirements: {invitee.dietary_req}")# Print the invitee dietary requirements
return
print(f"Invitee {invitee_name} not found.")# Print an error message if the invitee is not found
ifinvitee_name.strip()=="":
print("Please provide a proper name")
else:
foreventinself.events:# Iterate through the list stored in the instance variable "events"
invitee=next((xforxinevent.inviteesifx.name==invitee_name),None)# Iterate through the list of invitees of the event and return the first invitee object whose "name" attribute matches the input invitee_name or return None
ifinvitee:
print(f"Invitee {invitee_name} found in event {event.name}")# Print a message with the event name where the invitee is found
print(f"RSVP: {invitee.rsvp}")# Print the invitee RSVP status
print(f"Plus One: {invitee.plus_one}")# Print the invitee plus one status
print(f"Dietary Requirements: {invitee.dietary_req}")# Print the invitee dietary requirements
return
print(f"Invitee {invitee_name} not found.")# Print an error message if the invitee is not found
defview_events(self):
foreventinself.events:
...
...
@@ -154,38 +183,47 @@ class EventView:
defselect_menu(self):
event_name=input("Enter event name: ")# Prompt the user for input and assign it to the variable "event_name"
ifinvitee:#If the event exists in the list of events and if the list of invitee contains the variable invitee_name, start the while loop.
whileTrue:#The while loop will not end unless something returns False
iflen(event.menu.items)>0:#If the length of an item list is more than 0, continue.
meal_name=input("What are you having? : ")#Prompt the user for input and assign it to the variable meal_name
ifmeal_nameinevent.menu.items:#If the given meal_name from the invitee is in the menu, order is successful and the invitee_name and the ordered meal get stored.
event.track_invitee_meals[invitee_name]=meal_name
print("Ordered Successfully")
returnFalse
else:
print(f"{meal_name} not found. try again.")# Print an error message if the meal name is not found
returnTrue
else:
print("Add menu before selecting menu.")# Print a prompt message to add menu item before selcting a menu
returnFalse
else:
print(f"{invitee_name} is not in the invitee_list")# Print an error message if the invitee is not in the invitee list
ifevent_name.strip()=="":
print("Please provide a event name")
else:
print(f"Event {event_name} not found.")# Print an error message if the event is not found
ifinvitee:#If the event exists in the list of events and if the list of invitee contains the variable invitee_name, start the while loop.
whileTrue:#The while loop will not end unless something returns False
iflen(event.menu.items)>0:#If the length of an item list is more than 0, continue.
meal_name=input("What are you having? : ")#Prompt the user for input and assign it to the variable meal_name
ifmeal_nameinevent.menu.itemsandmeal_name.strip()!="":#If the given meal_name from the invitee is in the menu, order is successful and the invitee_name and the ordered meal get stored.
event.track_invitee_meals[invitee_name]=meal_name
print("Ordered Successfully")
returnFalse
else:
print(f"{meal_name} not found. try again.")
returnTrue
else:
print("Add menu before selecting menu.")
returnFalse
else:
print(f"{invitee_name} is not in the invitee_list")
else:
print(f"Event {event_name} not found.")
deftrack_meals(self):
event_name=input("Enter event name: ")#Prompt the user for input and assign it to the variable event_name