06 pop quiz + 11 testing,testing


Hey all, I don't really have a problem, but I do have a question

for the pygLatin, if the user enters a number it's supposed to print "empty" (in my version I print "please do not enter numbers"

my question is what do I write to restart the code after this? as in, once the user enters a number, I want it to print my text, but then prompt the user to enter another word

thanks :slight_smile:


the easiest solution would be a loop:

original = raw_input('Enter a word:')
while len(original) == 0 or not original.isalpha():
    original = raw_input("enter a valid word")

we do have to change the condition slightly. we want to check if the user doesn't enter an empty string (length zero) or that one of the characters is not alphabetic.

loops will be covered later, but if you have any questions about the loop, do ask


thank you :slight_smile: I guess I got ahead of myself


yep, you are running a bit ahead, no questions about the code? there is much in there which you don't know, you can ask about it if you want to understand it


thanks, but I don't have any questions concerning pyglatin as of now - I reached the end of the course and it was pretty clear - I only asked about the loop because the instructions for 11 were to test to make sure everything works fine - I took it a bit too literal hehe


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.