Die überprüfung von Benutzereingaben python

In meinem inputCheck-Funktion, wenn der Benutzer die Eingabe durch geführt wird, nachdem er überprüft, ob eine akzeptable Eingabe muss bestätigt werden, dass durch die print-Meldung und führen Sie dann eine andere Funktion - es jedoch nicht tun und ich kann nicht herausfinden, warum - Wären Sie in der Lage zu beraten, wie das problem zu lösen? Vielen Dank!

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()
  • Ich verstehe nicht, Ihre Frage.
  • lassen Sie mich Bearbeiten Sie Frage, sorry
InformationsquelleAutor user2166941 | 2013-03-25
Schreibe einen Kommentar