Invalid Syntax Glitch?


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

I cant figure out how this is invalid syntax I've tried everything


you forgot to put word before,

should be,

new_word = word[1: len(new_word)] + first + pyg


dave.n is right, you need to specify the string (or variable containing the string) before the square brackets, how else does python what it should take a slice off?

if i tell you, take a slice, you would ask me: of what? bread? apple? pie? python does the same, except it can't ask, so it throws an error instead


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