Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Python Object-Oriented Python (retired) Objects __init__

dmitriy ignatiev
seal-mask
.a{fill-rule:evenodd;}techdegree
dmitriy ignatiev
Python Web Development Techdegree Student 1,789 Points

What's wrong with my code

Hi,

I can not recognize what's wrong with my code below, could anybody explain me what is the problem. Thanks

student.py
class Student:
    name = 'Dmitiry'

    def__init__(self, name = 'Mark'):
        self.name = name

2 Answers

Ryan S
Ryan S
27,276 Points

Hey Dmitry,

You need to leave a space between def and __init__. It is helpful to always pay attention to the color of the keywords. Often you can figure out what's wrong with your code just by noticing that the color is off. In the Python code challenges, keywords like def and class will always be red, same with functions and conditional words like if, else, print, etc.

Hope this helps.