I'm trying to repeat a code that asks the user for a name, and thereafter asks for a new name. If the user writes a number, the program should ask for a new name. If the user types 'quit' the program should print how many names the user has entered.
So far I've solved it with a while-loop, but would like to do it WITHOUT using a while-loop and still keep prompting the user for new names.
participants=[]
count=0
while True:
    user_name=input("Course participant name: ")
    if user_name == "quit":
        print("Number of participants: ", count)
    elif user_name.isdigit():
        continue
    elif user_name.isalpha():
        participants.append(user_name)
        count+=1
    else:
        print("Invalid input")
        break
Any suggestions?
 
     
     
     
     
    