Introduction to Classes #3--What is the difference?


#1

Can anyone see what I am doing wrong on this problem? My code seems to be the same as the example in the hint:

Hint:
def init(self):
pass

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


#2

When I pasted both bits of code in they were properly indented as in the exercise. In the exercise, I have redone the indents just to make sure they were correct.


#3

@rubyrockstar13561

You have to format your code properly in the forum so that we can see what is going on, in Python white-space is 100% critical to the operation of the code so in order to help we need to see it.

How-to: Format your code

  1. Highlight code selection
  2. Press ctrl + alt + c or Press the </> key above the text entry area

OR

```python

# Code here

``` # end

#4

Here is my code--hopefully indented using ctrl + alt + c:

def init(self):
pass

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


#5

Last try to paste the code with indention:
...
def init(self):
pass

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


#6
```
code goes here
```

or

    code goes here

#7

Resolved the problem I think. It appears that init requires 2 underscores before and after. I did not see in the instruction where it said that. It certainly would have been helpful.


#8

Thanks for your update here rubyrockstar13561, I had exactly the same problem with the underscores. Saved me a headache. :+1:


#9

class Dog {

int age;

public Dog() {

}

public static void main(String[] args) {

}

}