class EggParty: def __init__(self): self.guests = [] def add_guest(self, guest_name): self.guests.append(guest_name) print(f"{guest_name} has joined the egg party!") def remove_guest(self, guest_name): if guest_name in self.guests: self.guests.remove(guest_name) print(f"{guest_name} has left the egg party!") else: print(f"{guest_name} is not at the party.") def show_guests(self): print("Current egg party guests:") for guest in self.guests: print(f"- {guest}") # 使用示例 party = EggParty() party.add_guest("Eggbert") party.add_guest("Eggwina") party.show_guests() party.remove_guest("Eggbert") party.show_guests()