.10 Ending Up - Error Message


#1

pyg = "ay"

original = raw_input('Enter a word:')

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

I get the following error message:

Oops, try again. word should contain the .lower()-case version of original.

What am I doing wrong?

Replace this line with your code.


#2

Here's my code that worked for me:

pyg = 'ay'

original = raw_input('Enter a word:')

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

print new_word

else:
print 'empty'

Hope this helps!


#3

That worked, thanks!


#4

No, problem took me ages to get this one. I had to read heaps of topics to work it out!


#6

Whaat????????????

When I press flag it wants me to tell it why it needs staff attention. Does it?


#7

Below is the code that worked for me.

pyg = 'ay'

original = raw_input('Enter a word:')

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

The following line solved all the previous errors I encountered:

new_word = word[1:] + first + pyg

It seems to me that learning to code well requires you to figure out how to consolidate and simplify the code. I understand that a lot of this code is presented the way it is so that everything is understood well before progressing to more intricate/difficult lessons, but it's important to remember that there are numerous ways to achieve the same goal.


#8

True, there is more than one answer to use but you can't use all of them at once. I just gave my answer that worked for me is all. But I'm quite happy for you to show other ways of answering the question.


#9

It wont work for me it say word = original.lower() in the console rong


#10
a = input('Enter a word: ')
if a.isalpha():
    a = a[1:] + a[0] + 'ay'
    print(a)
else:
    print('empty')

Can use so?


#11

pyg = 'ay'

original = raw_input('Enter a word:')

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


#12

Thanks! The instructions weren't helpful at all.


#13

Idk what happened but my code didn't work. I mean the console accepted it but it did not changed the word i wrote in. I copyed a code from the forum (which looked exactly like mine) and put it back to the script and it worked properly. The 2 code are the same but mine didn't worked but the one i copyed work. What kind of bug is this?