samedi 9 octobre 2021

Function Loop only runs once Python3

Hi im a new coder and I made a couple of programs 1. guessing game 2. convert morse code and 3. convert int to roman numeral and I wanted to make a program where the user would choose what kind of program he/she would like to use, my problem is that the specific program like guessing game only runs once and if I choose it again it wont run, I tried putting them in a function then looping that function but its the same output any feedback would be appreciated. Below is my code (Sorry english is not my first language.)

again = "Y"
while again == "Y":
print("What do you want to do? ")
print("1. Guess the number \n2. Convert Morse Code to English Alphabet \n3. Convert the digit into Roman Numeral Equivalent \n4. Exit")
options = int(input("Choose an option 1-4 "))
if options == 1:
    from Game import *
    print(game)
elif options == 2:
    from MoreseCode import *
    toMorseCode
elif options == 3:
    from Roman import *
    userInput, conversion
elif options == 4:
    print("Goodbye now ")
    break
else:   
    print("Incorrect Input")
again = input("Do you want to try again? Y/N ").upper()

Aucun commentaire:

Enregistrer un commentaire