I'm having trouble getting a while loop to work here. What I would like to do is have the program jump back to "please enter the word you with to translate" once it runs and provides the output.
When I have used while true and continue in what I believe are the proper places, it simply continues to print the output. of the word I'm translating. Hope that makes sense.
Listed below is the code I have working. The second chunk is where I add the while loop and run into issues.
def silly_alpha():
print("Looks like we're going with the Impossible alphabet.")
word_trans = input('Please enter the word you wish to translate: ')
if word_trans.isalpha():
for letter in word_trans:
print(impossible.get(letter.lower()), end=' ')
else:
print("There's no numbers in words. Try that again.")
This is the problematic code
def silly_alpha():
print("Looks like we're going with the Impossible alphabet.")
while True:
word_trans = input('Please enter the word you wish to translate: ')
if word_trans.isalpha():
for letter in word_trans:
print(impossible.get(letter.lower()), end=' ')
continue
else:
print("There's no numbers in words. Try that again.")
continue
continueat all.continuewill continue with the most inner block. Theforiteration in theifcase and thewhilein theelsecase.continueforbreak. Maybebreakis what OP is looking for?