我尝试过更改“if”语句并使用 else 代替“elif”,但是当使用 Change 函数时,它会忽略“n”或“N”输入。
class Settings:
def __init__(self):
self.text_speed = 1
self.companion_name = ("")
self.player_name = ("")
def Change_Text_Speed(self):
choice = int(input("Text Speed Options:\n1.5x [1] \n2x [2] \n2.5x [3] \nExit[4]"))
if choice == 1:
self.text_speed = (self.text_speed*1.5)
elif choice == 2:
self.text_speed = (self.text_speed*2)
elif choice ==3:
self.text_speed = (self.text_speed*2.5)
else:
print("No changes have been made...")
def Change_Companion_Name(self):
choice = str(input("Do you wish to change your companions name?[Y/N]"))
if choice == 'y' or 'Y':
new_name = str(input("Enter in your companions new name: "))
self.companion_name = new_name
elif choice == 'n' or 'N':
print("No changes have been made...")
def Change_Player_Name(self):
choice = str(input("Do you wish to change your name?[Y/N]"))
if choice == 'y' or 'Y':
new_name = str(input("Enter in your new name: "))
self.player_name = new_name
elif choice == 'n' or 'N':
print("No changes have been made...")