这是我将要制作的 RPG 的开始,它运行顺利,直到我尝试通过说是或任何其他激活 if 语句的答案来改变性别。有什么我忘记了吗?PS对此感到抱歉。我是业余爱好者。
import random
import time
def Intro():
print('Hit enter to begin.')
input()
print('Please choose a name for your character.')
PlayerName=input()
def KeepName():
print('You have chosen "' + PlayerName + '" as your character\'s name.')
print('Do you wish to keep this as your name? (yes or no)')
return input().lower().startswith('n')
while KeepName():
print('Please choose a name for your character.')
PlayerName=input()
planet = 'Sykahrox VII' #Useless as of this point but I kept it in so I can remember the name of the planet.
def gender():
print('Do you want to be Male, or Female?')
choice = input().lower()
if choice in ('m', 'male', 'boy', 'guy', 'dude'):
return 'Male'
if choice in ('f', 'female', 'girl', 'woman'):
return 'Female'
ChangeGen = 'y'
while ChangeGen in ('y', 'yes', 'yeah', 'yup'):
genderchoice = gender()
print ('You have chosen ' + genderchoice + ' as your gender. Do you wish to change this?')
ChangeGen = input().lower
if ChangeGen in ('y', 'yes', 'yeah', 'yup'):
gender()
Intro()