Ending UP


#1

So I don't understand this topic and can't comprehend why it won't work.
pyg = 'ay'

original = raw_input('Enter a word:')

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


#2

Can you include your error message?


#3

Okay here is a screenshot

c


#4

wait hold on on a second


#5

I will just type it...
it says"Oops, try again. Your code did not run to end - see the console window for the error message."


#6

The first error is in this line

it needs to be word = original.lower()
Additionally,

this needs to be directly after

so far you 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 = word[1:len(new_word)]

Now, you need add the line new_word += first + pyg, then print new_word, and lastly, add an else statement that prints 'empty'

I hope this helps


#7

There is still a problem because it still says my syntax is invalid
File "python", line 9
new_word=[1:len(new_word)]
^
SyntaxError: invalid syntax


#8

Will you include your entire code?
Copy and paste it and then highlight it and press

this button.


#9

when taking a slice, you have to specify where you want to take a slice off, for example:

s = "hello world"
print s[0:5]

see how i place the variable (in this case s) in front of the square brackets to specify i want a slice off s


#10

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