Ending Up


#1



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


I've entered the text in multiple different ways, with the slice above & below else. With the code provided in the hint, in other suggestions & below. I've also restarted the module & can't figure where I am going wrong.


I thought the characters would move?


Replace this line with your code. 
pyg = 'ay'

original = raw_input('Enter a word:')

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

new_word = word + first + pyg
new_word[1:len(new_word)] 

else:
    print 'empty'


#2

I then used the following:


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[0:len(new_word)]


Then it says, new_word contains (lets say) 'zaczay' instead of 'aczay'


#3

new_word should contain the final correct translation, so you need to store the result of the slice action in new_word variable


#4

new_word = new_word[1:len(new_word)]

I was missing this line apparently. Through trial and error, not quite sure I understand it though. I thought using the = would then store new_word as a value in the new_word variable, so storing itself... Aha, I might need to read more into this.


#5

updating/re-assigning variable, this must have been covered at some point in this course?


#6

It most likely does, it must have gone over my head. My own fault, keep up the good work! Thanks for the assist & have a good day! :slight_smile:


#7

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