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 -
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 -
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()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)