Initializing a class (5) bug


#1

I want to report a bug on the exercise 5. Initializing a class

class Car(object):
    def __init__(self, model, color, mpg):
    condition = "new"
    self.model = model
    self.car = car
    self.mpg = mpg

my_car = Car("DeLorean", "silver", 88)
print my_car.condition

As you can see, my code will output an Indentation Error.
But i pass the exercise even when i recive this error.
EDIT: after fixing the indentation, i noticed that i wrote car instead of color, and i put the member variable inside init. and still got the pass the exercise.
Hope i helped :slight_smile:


#2

As I suspect There is not bug.
You mistakenly put

condition = "new" inside the init function.
It is a member variable, It should be outside of any function.
I hope you get the hint. :slight_smile:

Hint**


#3

Hi greentreemee!
as i wrote in the edit, i noticed i put the member variable in the init, and changed it, but i passed the lesson with a lot of errors, and thats the bug. i dont think i should be able to pass the exercise when i have 3 or 4 mistakes, especially when i get the same code i wrote in the next exercise.


#4

You will have less errors if you read the instructions and theory of a section properly.

i dont think i should be able to pass the exercise when i have 3 or 4 mistakes, especially when i get the same code i wrote in the next exercise.

1.Before putting the question in forum search (on your favorite search engine) like this > "About error you're getting" + Codecademy, most searches will help you to solve your problem.

2.If you still get problem or unable to understand the problem then just post it in the forum specifying the errors(i.e you're getting). Most of the time Someone will point the problem out.

Just keep trying and you'll get there! :thumbsup:


#5

Hi,
i think you didnt understand me.
Im not having truble with this lesson. i understand my mistakes and beleive me, I will not post anything before serching.
I wrote the code with 3 errors. Indentation Error, instead of color i wrote car, and i put the member variable in the init method.
With the code from the first post, when i press "Save & Submit Code", it says "Way To Go" and i can go to the next lesson.
I think that if i have errors, i should not be able to go to the next lesson.
I googled report a bug on codecademy, and i found that i need to post bugs in this forum. here
Again, Im not having any problem, this site is amazing, and i just want to help make it better :slight_smile:


#6

Surely I did not understood you in last post hehe!:grinning:

this site is amazing, and i just want to help make it better :slight_smile:

Exactly this site is great and yup that's a good idea! :thumbsup:


#7

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