I'm having some trouble 10/10


#1

My code doesn't run correctly, this is what I have

pyg = '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 = [1:len(new_word)]
print original
else:
print 'empty'

if someone can tell me what's going on that would be great c:


#2

The problem is on this line:

When you use [1 : len(new_word)] you're taking a slice and assigning it to new_word. However, you didn't specify where you were taking the slice from! To do this, change the line above to new_word = new_word[1 : len(new_word)]. This says that you're taking the slice [1 : len(new_word)] from new_word itself and assigning it to itself, new_word.


#3

i did that... but it still says "invalid syntax" where the colon is...


#4

You are printing the original not the new word.


#5

@philbobdirbus did you use all of new_word = new_word[1 : len(new_word)]?


#6

pyg = "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 new_word

else:
print "empty"


#7

This code works for me...after lots of trail and errors...is probably not the perfect way but...

pyg = '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 [0:len(new_word)]
new_word=new_word[1:len(new_word)]
print new_word

else:
print 'empty'


#8

I got that exact same error message.