I’m totally new to coding and am working on a function that gets a name from a potential player of the game. This code works if the player answers “T” on the fourth line
istrue = input(f"\nT or F: {first_name} {last_name} is your name? ")
But if the player enters “False”, when the loop repeats itself, it returns ‘None’ in the second function. I don’t know why. Also, I don’t know if I am formatting this question properly in the forum.
Thanks for any input!
def getname():
first_name = input("What is your first name? ")
last_name = input("What is your last name? ")
istrue = input(f"\nT or F: {first_name} {last_name} is your name? ")
if istrue.lower() == 't' or istrue.lower() == 'true':
name = first_name + ' ' + last_name[0]
return name
print(f"\nThank you, {name}!\n")
elif istrue.lower() == 'f' or istrue.lower() == 'false':
print("\nMy mistake...")
getname()
else:
print("\nI'm sorry, that was not an option.\n")
getname()
def quest():
print(f"{player}, do you want to go on a quest? ")
questing = input("1. Yes \n2. No\n > ")
if questing == '1':
print(f"Too bad, {player}.")
elif questing == '2':
print(f"Too bad, {player}...there's no returning now! Muah ha ha!")
else:
print(f"""{player}, that wasn't an option.
\nLet's try this again...\n""")
quest()
player = getname()
playing = quest()