在我的 inputCheck 函数中,当用户输入在检查后通过是否是可接受的输入时,应该通过打印消息确认,然后运行另一个函数 - 但是它没有这样做,我不知道为什么 - 你能建议如何解决问题?非常感谢!
def main():
print('WELCOME TO THE WULFULGASTER ENCRYPTOR 9000')
print('==========================================')
print('Choose an option...')
print('1. Enter text to Encrypt')
print('2. Encrypt text entered')
print('3. Display Encrypted Text!')
menuChoice()
def menuChoice():
valid = ['1','2','3']
userChoice = str(input('What Would You Like To Do? '))
if userChoice in valid:
inputCheck(userChoice)
else:
print('Sorry But You Didnt Choose an available option... Try Again')
menuChoice()
def inputCheck(userChoice):
if userChoice == 1:
print('You Have Chosen to Enter Text to Encrypt!')
enterText()
if userChoice == 2:
print('You Have Chosen to Encypt Entered Text!')
encryptText()
if userChoice == 3:
print('You Have Chosen to Display Encypted Text!')
displayText()
def enterText():
print('Enter Text')
def encryptText():
print('Encrypt Text')
def displayText():
print('Display Text')
main()