I appreciate any help - Using Python 2.7 -->
Also, it's unclear to me how to format code on this site -
Error --->
Traceback (most recent call last):
File "/Users/meldejesus/Desktop/New_stuff/Code/newApps/Python_experiments/class.py", line 28, in <module>
cat1 = Cat("Fuzz")
TypeError: __init__() takes exactly 1 argument (2 given)
I appreciate any help - Using Python 2.7 -->
Also, it's unclear to me how to format code on this site -
Traceback (most recent call last):
File "/Users/meldejesus/Desktop/New_stuff/Code/newApps/Python_experiments/class.py", line 28, in <module>
cat1 = Cat("Fuzz")
TypeError: __init__() takes exactly 1 argument (2 given)
Also, it's unclear to me how to format code on this site -
Error --->
Traceback (most recent call last):
File "/Users/meldejesus/Desktop/New_stuff/Code/newApps/Python_experiments/class.py", line 28, in <module>
cat1 = Cat("Fuzz")
TypeError: __init__() takes exactly 1 argument (2 given)
I appreciate any help - Using Python 2.7 -->
Also, it's unclear to me how to format code on this site -
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
class Dog( object ): def __init__( self , name): self .name = name self .age = 6 def age_update( self , age_update): self .age + = age_update print ( "new age: " + str ( self .age)) def speak ( self ): print ( "My name is " + self .name + "and I'm " + str ( self .age)) class Cat(Dog): #connects it to above def __init__( self , lives): # connects to what it will create super (Cat, self ).__init__(name) self .lives = CatNature() class CatNature(): def __init__( self , lives = 9 ): self .lives = lives def show_lives( self ): print ( "This cat has " + str ( self .lives) + " lives" ) cat1 = Cat( "Fuzz" ) print ( "Cat's name is " + cat1.name + " and " + str (cat1.age)) cat1.lives.show_lives() |
File "/Users/meldejesus/Desktop/New_stuff/Code/newApps/Python_experiments/class.py", line 28, in <module>
cat1 = Cat("Fuzz")
TypeError: __init__() takes exactly 1 argument (2 given)