Ending up Why is the word repeating!


#1

Why is the word repeating!!!




Oops, try again.
It looks like new_word contains "iiay" instead of "iay"!




pyg = 'ay'

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


#2

here:

new_word[1:len(new_word)]

you take the slice, but you don't store this slice anywhere.


#3

I do not understand what you mean


#4

look:

x = "hello world"
x[0:6]
print x # will output hello world

i take a slice of a string, but i don't store this slice anywhere, so when i then print x it will show the full string. i need to store the slice in a variable. So do you, how do you think this is done?


#5

NVM I have already finished that lesson. :slight_smile:


#6