Word Up


pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha() :
    word = original.lower()
    first = word[0]
    print original
    print 'empty'

I have also tried putting the word variable and first variable inside of the colon but that was not working either. It keeps saying did I define the variable word?


what do you enter when you are prompted by raw_input? You need to enter a valid word



I made it capital so that it would do the lower case function


so i ran your code:

and it runs fine?


mine still comes back and says the same thing



You have to create a variable, just after the variable "word" called "first" that contains the first letter of word.


in the code you original posted you had first:

first = word[0]

why did you remove it?


mine is still not working..

pyg = 'ay'

print 'Welcome to the Pig Latin Translator!'

Start coding here!

def restart():
original = raw_input("Enter a word:")
if len(original) > 0 and original.isalpha():
word = original.lower()
first = word[0]
print original
print word
else :
print "Please enter a valid word."
print "Please don't enter any non-alphabet characters."


adding additional things (like a function), might cause problems, as it did in this case


A post was split to a new topic: Word up


A post was merged into an existing topic: Word up


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