Problem with PigLatin


File "python", line 11
SyntaxError: invalid syntax
It keeps on giving me an error message and I'm not sure what to do.

I expect it to run correctly. Giving me a raw input ,and than slicing off the first index and adding ay at the back of the 'new word'

pyg = 'ay'

original = raw_input('Enter a word:')

if len(original) > 0 and original.isalpha():
    print original
    word= original.lower()
    first= word[0]


If you want the second item on the shelf, then it's not sufficent to say "the second item", instead you would need to say "the second item on the shelf", same goes for slicing, you have to say what you're slicing


Oh OK sorry. This is kind of my first time coding or learning a programming language.So I am quite familiar with certain terms.
I meant that once I type out the word in the counsel eg. Cat .The first letter was sliced off, and than added at the back of the remaining word and 'ay' was also added e.g. new_word =word+first +pyg.


I was referring to your code
The exercise is about slicing
You're slicing some value
But you're not specifying which value, which makes it nonsense - syntax error

From the second to the end
...of what?


Ok but when its raw input doesn't it mean that I should enter the as you said value or word into the counsel.And then I save it by the variable original .


Still just the slicing. See the line number in your syntax error. You have a start index and a stop index, but nowhere does it say which value is to be sliced, what you've written doesn't match anything that python recognizes. Compare to the example(s) in the instructions


Thank you for making it clear.


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