I think it is something like this that you are looking for.
import time
print("What's your name?")
character_name = input("Type it in here: ")
print("How old are you?")
character_age = input("Type your age in here here: ")
def isMale():
Male = input("You're a male? True or False?")
if (Male == "True"):
Male_Bool = True
elif (Male == "False"):
Male_Bool = False
if (Male_Bool) == True:
print("There was a man named " + character_name + ", ")
print("he was " + character_age + ".")
print("He likes the name " + character_name + ", ")
print("but didn't like being " + character_age + ".")
#Check if Male_Bool is False
elif(Male_Bool) == False:
print("There was a woman named " + character_name + ", ")
print("she was " + character_age + ".")
print("She likes the name " + character_name + ", ")
print("but didn't like being " + character_age + ".")
return
#Call the function
isMale()
time.sleep(10)
Also have a look at your code restructured.
import time
def isMale():
Male = input("You're a male? True or False?")
if (Male == "True"):
Male_bool = True
else:
Male_bool = False
return Male_bool
character_name = input("What's your name?")
character_age = input("How old are you?")
male = isMale()
if male:
print(f"There was a man named {character_name},")
print(f"he was {character_age}.")
print(f"He likes the name {character_name},")
print(f"but didn't like being {character_age}.")
else:
print(f"There was a woman named {character_name},")
print(f"she was {character_age}.")
print(f"She likes the name {character_name},")
print(f"but didn't like being {character_age}.")
time.sleep(10)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…