Understanding problem variabel assignment



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


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

print 'empty'

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


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