Help needed for coding beginner

Hi everyone I have recently begun working with attributes and I keep getting this error and cannot figure out why help would be greatly appreciated

The only error I can see here, is the fact that you’ve posted a screenshot :slightly_smiling_face:

Not even a SS, rather a (very poor) photo from your mobile.

2 Likes

Well, it seems we’ll need to rally up yet another debugging tool, pictured below, to resolve this problem …

SyntaxError

The camera of my mobile phone was also used in this debugging session.

It appears that there is no space between def and __init__ in your code. That may be the source of the SyntaxError. But it would have been much easier to find it if you had copied and pasted your code, along with the error message.

2 Likes

Thank you as soon as I post this question I noticed it but I thought it couldn’t be that simple

1 Like

The Python interpreter, of course, did not know what you were actually trying to do. It may be obvious to us that you were attempting to define an __init__ method, but to the interpreter, it may appear that you were attempting to call a function named def__init__, passing it two arguments named self and color. But with the colon at the end of what could have been a function call, that line made no sense to the interpreter, and a SyntaxError was raised.

We wish you the best of success with your learning Python. Feel free to ask questions, but please copy, paste, and format code and error messages in your posts, rather than supply pictures of it.

1 Like

@pooman, it’s not too late to edit your original post and paste the text from your screen using the ‘>’ code block control character. That way, someone reading this post can see the error and perhaps learn from it without using a magnifying glass as Querecus did (purely as a joke).

If you access discuss.python.org on the computer in your photo, you’ll be able to copy-paste directly into Discuss.Python.

Punctuation is also an excellent practice. Run-on sentences are quite unpleasant to parse.

1 Like