Ending Up


#1



https://www.codecademy.com/en/courses/python-beginner-2W5v7/1/4?curriculum_id=4f89dab3d788890003000096


Oops, try again. The value for the original variable looks off, make sure that you entered a word containing only letters.


pyg = "ay"
word = "word"
word = word.lower()
first = word[0]
new_word = word + first + pyg
new_word = new_word[1:len(new_word)]
print new_word


#2

Hi ajaxblaster.

Could you please post you whole code so i can analyze the problem and make more sense of it.


#3

May i suggest going through the activity again because i feel that you have made a couple mistakes.


#4

pyg = "ay"
word = "word"
word = word.lower()
first = word[0]
new_word = word[1:] + first + pyg
print new_word

You need to splice the first letter out of the original input word.


#7

Hi,

what's the problem with is this code?

pyg = 'ay'

original = raw_input('Student')

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)]

showing me "The value for the original variable looks off, make sure that you entered a word containing only letters."


#8

That's what I am trying to figure out. Getting the same error


#9

It is the complete code.


#10

Alright chill.

Ill help you step by step.


#11

Hi friendzz,

this code is not wrong it's perfectly fine.

This you need to fix:
1.Make sure to add your indents at the appropriate places.
2.Transfer all of these codes too your if statement except for your print "empty" syntax but remember too add indents though.

else:
print 'empty'
print 'word'
new_word = word[0:] + first + pyg
print 'new_word'

Finally fix up this code.

new_word = word[0:] + first + pyg

well more precisely fix up this part of your code.

word[0:]

it should not be zero it should include.

1:len(new_word)

instead of zero.

I hope this helps

-Peter


#12

Hi netninja47227.

Please check your code more carefully.

Problems of your script/code.
1.Fix this syntax.

original = raw_input('Student')

2.Delete unnecessary code.
including:

  • print 'original'
  • new_word = "new_word" [1:len(new_word)]

3.Fix up these/this script

  1. new_word = word + first + pyg

4.Some code are in the wrong place in the program
Transfer these codes to you if statement:

  • Everything except for this code:

print 'empty'

Hope this will help you in your journey to becoming a programmer :smile:

-Peter


#13

Hi ajaxblaster15829.

Please check you whole code and make it similar too the others or redo the lesson on codecademy because you have several things too fix.

hope this helped you in any way.

-Peter


#14

pyg = "ay"
word = "word"
word = word.lower()
first = word[0]
new_word = word[1:] + first + pyg
print new_word

You need to splice the first letter out of the original input word.

moneymiles is correct with his suggestion :smiley:


#16

Yes, you were right. I started from the beginning. It worked. Thanks a ton!


#17

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