What´s wrong with my code?!


I am new to coding, so I´m not quite sure where I´m wrong... The error message says my syntax is incorrect, but I just can´t simply find the error. Can someone please help me?

Here it is my code...

original = raw_input('Enter a word:')
pyg = 'ay'

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 new_word
    print 'empty'


Here is your problem. new_word not only has to equal [1: len(new_word)] but also something else with [1: len(new_word)]. For example

new_word = something[1: len(new_word)]

Also, just suggesting this not necessary, but I would have a print original in your code in your if statement just so you can see the original word and the new word printed on the computer screen.


oowww now I see! Thank you so much!


Good! Glad to have enlightened you on the subject! :smiley: Happy coding!


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