-6

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":
jonrsharpe
  • 115,751
  • 26
  • 228
  • 437
Popeye
  • 1
  • 4
  • Did you read this before posting? – jonrsharpe Nov 08 '20 at 20:11
  • @jonrsharpe, dude im new to this I only started coding a week ago, I think i formatted it better now. Also do you have any clue what to do here? – Popeye Nov 08 '20 at 20:25
  • https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response – Prune Nov 08 '20 at 20:30
  • 2
    Does this answer your question? [Asking the user for input until they give a valid response](https://stackoverflow.com/questions/23294658/asking-the-user-for-input-until-they-give-a-valid-response) – DCCoder Nov 08 '20 at 22:14

1 Answers1

-1

Just a simple and quick answer, maybe there is easier way.

fullName = input("Hello there, what is your name?")
fName, sName = fullName.split()

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

while not (answer == "Yes" or answer == "yes"):
    fullName = input("Hello there, what is your name?")
    fName, sName = fullName.split()
    print("So, your first name is", fName) 
    print("and your second name is", sName)
    answer = input("Is this correct?")
C.K.
  • 4,348
  • 29
  • 43