Register a participant
python · static example
attendees = []
def register(name, event):
clean_name = name.strip()
if not clean_name:
return "Name is required"
attendees.append({"name": clean_name, "event": event})
return f"{clean_name} registered for {event}"
print(register("Asha", "Python Meetup"))
print(len(attendees))`strip()` removes surrounding whitespace. This simple example keeps data in memory; it does not save registrations to a database.