3/19


#1

need help finding out whats wrong with my code:

class Animal(object):
def init(Animal):
pass
init(self):
pass


#2

Helps if you show exactly what your code looks like and explain what you expected to happen and what happened instad.


#3

You should google python classes you need to look up how they are structured.

Example:

class ThisISClass(object):
    def __init__(self):
        self.classvar = 1
    def class_method(self, work_var):
        return self.classvar * work_var

a_class = ThisISClass()
print(a_class.class_method(6))

That is how you create a class.


#4

Hi , can you write the right code for this exercise? thanks


#5
class Animal(object):
    def __init__(self):
        pass

#6

A great thanks for your response.You may not beleive it : i saw your 2 answers - when i put this one(def init(self): ,, it says wrong syntax showing the : symbol ,, and when i put this one( def init(self): ) with no indents as your answer ,, it says to me : did you put the pass keyword into the body of init()? make sure you indent correcty . i'm very confused , again thanks a lot


#7

teempe , thanks a lot , forget my last comment .I write your answer and it passed.I don't know ifther was a bug in the exercise , thank you anyway !!!!!!!


#8

I was just about to answer. Good to know that it finally works :smile:


#9

omg i have been killing my self trying to figure out why mine didn't work.

it's TWO underscores, i kept typing _ init _

I feel like an idiot LOL


#10

oh my god, I met the same trouble. It takes me a long time.


#11

*Facepalm. Me too!