104k views
1 vote
Define a new class Fighter that inherits from Spaceship. Add a variable property weapon that defaults to an empty string and a variable property remainingFirePower that defaults to 5.

1 Answer

3 votes

Answer:

class Fighter(Spaceship):

weapon = ""

remain_fire_power = 5

Step-by-step explanation:

The class "Fighter" is a python class that inherits all the variables and methods from the Spaceship class. The Fighter class is considered the child class while the Spaceship class is known as the parent class. The weapon and remain_fire_power variables are class variables unique to the fighter class and defaulted to an empty string and 5 respectively.

User Jotapdiez
by
7.3k points