[Python] How do I make it so that the code will ask you your name again if the user answers no...

Discussão em 'Python' iniciado por Stack, Março 13, 2025.

  1. Stack

    Stack Membro Participativo

    Here is my code:

    fullName = input("Hello there, what is your name?")

    fName = (fullName[0:fullName.index(" ")])

    sName = (fullName[fullName.index(" ")+1:])

    print("So, your first name is", fName)
    print("and your second name is", sName)
    answer = input("Is this correct")


    Here is where I'm having most of my issues, everything before this works fine to my knowledge:

    if answer == "Yes" or answer == "yes":
    print("Great, lets get started!")
    elif answer == "No" or answer == "no":

    Continue reading...

Compartilhe esta Página