how can I make it so I my function will not accept intergers

user_input = raw_input('Welcome to Pyg Latin. Please enter a word:')

pyg = "ay"
user_first_letter = user_input[0]
user_word_sliced = user_input[1:]

def pyg_latin_function():
    if len(user_input) >= 3 :
        print user_word_sliced + user_first_letter + pyg
    else :
        print 'word please'
print pyg_latin_function()


Do you want absolutely no numbers in the string at all i.e. "string1" or only actual numbers i.e "12"?

But as a general rule, you will either use an if statement or a try statement, maybe in a loop.


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