Understanding problem variabel assignment


#1



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


I hope this is the right place for this question. I asked myself why the line below works, even though you access the length of the variabel during assigning it? Does the code just count the characters which have been assigned already?


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


#2

yg = '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:len(new_word)]
print original + " changed"
print new_word

else:
print 'empty'

new_word = new_word[1:len(new_word)]
this is were you have misstake you need to writ new _word


#3

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