Repeating code (loops)


#1

Hey codeacadamy community,

Does anyone have an idea on how to make this code repeat so the user could enter another word to be translated.

Also, how to allow the user to enter another word if they did not enter anything initially.

  • Much appreciated -

pyg = 'ay'

original = raw_input('Enter a word:')
original = original.lower()

word = original

if len(original) > 0 and original.isalpha():
print new_word

first = word[0]
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]

else:
print 'empty'`


#2

Wrap it all in a function, then call the function as many times as you want.


#3

loops would be the best methods, but are they covered yet? You can also use functions, how do you think you should achieve this?