Hi everyone,
I am working my way through the python for kids book and one of the challenges requires me to create a class to make a giraffe dance - I know,I know it's sounds silly but what can I say ;-)
The problem is in the last line. Can someone please explain why I am getting this error?
Thank you all. Also, sorry if the indentation gets messed up I am new to the forums.
============================================================
AttributeError: 'Giraffes' object has no attribute 'dance'
============================================================
I am working my way through the python for kids book and one of the challenges requires me to create a class to make a giraffe dance - I know,I know it's sounds silly but what can I say ;-)
The problem is in the last line. Can someone please explain why I am getting this error?
Thank you all. Also, sorry if the indentation gets messed up I am new to the forums.
============================================================
AttributeError: 'Giraffes' object has no attribute 'dance'
============================================================
class Animals: def breath(self): print('breathing') def move(self): print('moving') def eat_food(self): print('eating') class Mammals(Animals): def feed_young_with_milk(self): print('feeding young') class Giraffes(Animals): def eat_leaves_from_trees(self): print('eating leaves') class Giraffes(Mammals): def left_foot_forward(self): print('left foot forward') def right_foot_forward(self): print('right foot forward') def left_foot_back(self): print('left foot back') def right_foot_back(self): print('right foot back') def dance(self): self.left_foot_forward() self.right_foot_forward() self.left_foot_back() self.right_foot_back() reginald = Giraffes() reginald.dance()