Given the following Sample Code, practice using inheritance to create specific child classes for different types of Pokemon
.
- When attacking a fire type, the attack is more effective
- When attacking a grass type the effect is less effective
- When
growl
is called print outSplish Splash
- When attacking a water type, the attack is less effective
- When attacking a grass type the effect is more effective
- When
growl
is called print out "Fire Fire"
- When attacking a water type, the attack is more effective
- When attacking a fire type the effect is less effective
- When
growl
is called print out "Cheep Cheep"
Note: In order to check what type an object is you can use isinstance
which takes in an object, a class and returns a Boolean if the object is the type of the inputted class.
my_pet = Pet()
isinstance(my_pet, Pet) # returns true
isinstance(my_pet, Dog) # returns false