Python Practice/ Ending Up


#1

pyg = 'ay'

original = raw_input('Enter a word:')

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

File "python", line 8
new_word = [1:len(new_word)]
^
SyntaxError: invalid syntax

Plz help it only calls that part of the code wrong.


#2

when you take a slice and store it in a variable, you need to specify of what you take a slice:

x = "hello world"
x = x[0:5]

see how i specify i want a slice of x? you will need to do the same for new_word


#4

Ty I tried the simpler method, the one in the instructions didn't work.


#5

can you post an updated version of your code?


#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:]
    print new_word
else:
    print 'empty'

#7

your code works fine, try refreshing the page/different browser


#9