American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

10 AM – Python OOP – Indo – Gamas

January 26 @ 10:00 am - 11:00 am

Today We Did
  1. We learned about inheritance in Car and ElectricCar classes.
  2. We learned on how to make a class inherits another class.
  3. We learned inherits means a child class (ElectricCar) gets all the attributes and methods of its parent class (Car).
  4. We learned on how to override parent’s method.
  1. Inside monster_inheritance project, create a new file
  2. Inside, create a new class called Dragon.
  3. The Dragon class has to inherits form Monster class.
  4. Inside the Dragon class, override def magic_attack(self, damage, magic_type) method so when the dragon get water magic_type the damage will be doubled. And also say, “Dragon is weak against water magic, hence the damage is doubled. 2 x 50 damages”. We did method override earlier in the car inside ElectricCar.add_more_gasoline(self, amount) method.


January 26
10:00 am - 11:00 am
Verified by MonsterInsights