Oops, try again. Did you create a variable called word?


#1

Printed:

Enter a word:
None

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original)>0 and original.isalpha():
word= original.lower(0)
first= word[0]
newword=word[1:len(newword)]+ first + pyg
print original
print word
print first
print new_word
ele
print "word"

please help me understand my error


#2

remove the 0 in between parentheses,


#3

typo here should be else:


#4

I did that printed:'

Enter a word:
None

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original)>0 and original.isalpha():
word= original.lower()
first= word[0]
newword=word[1:len(newword)]+ first + pyg
print original
print word
print first
print new_word
ele
print "word"

still getting the same message


#5

did that:

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original)>0 and original.isalpha():
word= original.lower()
first= word[0]
newword=word[1:len(newword)]+ first + pyg
print original
print word
print first
print new_word
else:
print "word"

printed:

File "python", line 13
else:
^
SyntaxError: invalid syntax

error message:

Oops, try again. Did you create a variable called word?


#6

never mind I solved it thank you


#7

I solved it thank you for your help


#8

How did you solved it?


#9

pyg = 'ay'

original = raw_input('Enter a word:')
word= original
first= word
new_word= word + first + pyg
if len(original)>0 and original.isalpha():
word= original.lower()
first= word[0]
newword=word[1:len(newword)]+ first + pyg
print original
print word
print first
print new_word
ele
print word

At the beginning after original=raw I added Word=original and first=word. when you do that you create the variable original. I made it bold to point it out. hope this helps


#10

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