Write the PokemonExtra class so that the following code generates the output below: class PokemonBasic: | OUTPUT: ---Basic Info: -- def _init_(self, name = 'Default', hp = 0, weakness = 'None', type = 'Unknown'): self.name = name Name: Default, HP: 0, Weakness: None Main type: Unknown Basic move: Quick Attack self.hit_point = hp self.weakness = weakness self.type = type --Pokemon 1 Info: - Name: Charmander, HP: 39, Weakness: Water Main type: Fire Basic move: Quick Attack def get_type(self): return 'Main type: + self.type --Pokemon 2 Info:-- Name: Charizard, HP: 78, Weakness: Water Main type: Fire, Secondary type: Flying Basic move: Quick Attack |Other move: Fire Spin, Fire Blaze def get_move(self): return 'Basic move: '+ 'Quick Attack' def _str_(self): return "Name: " + self.name + ", HP: " + str(self.hit_point) + ", Weakness: " + self.weakness ---Basic Info: print('\n------. pk = PokemonBasic() print(pk) print(pk.get_type()) print(pk.get_move()) ') --- Pokemon 1 Info:- print('\n------ charmander = PokemonExtra('Charmander', 39, 'Water', 'Fire') print(charmander) print(charmander.get_type()) print(charmander.get_move()) ------') print('\n---- charizard = PokemonExtra('Charizard', 78, 'Water', 'Fire', 'Flying', ('Fire Spin', 'Fire Blaze')) print(charizard) print(charizard.get_type()) print(charizard.get_move()) ---Pokemon 2 Info:-- ------')
Write the PokemonExtra class so that the following code generates the output below: class PokemonBasic: | OUTPUT: ---Basic Info: -- def _init_(self, name = 'Default', hp = 0, weakness = 'None', type = 'Unknown'): self.name = name Name: Default, HP: 0, Weakness: None Main type: Unknown Basic move: Quick Attack self.hit_point = hp self.weakness = weakness self.type = type --Pokemon 1 Info: - Name: Charmander, HP: 39, Weakness: Water Main type: Fire Basic move: Quick Attack def get_type(self): return 'Main type: + self.type --Pokemon 2 Info:-- Name: Charizard, HP: 78, Weakness: Water Main type: Fire, Secondary type: Flying Basic move: Quick Attack |Other move: Fire Spin, Fire Blaze def get_move(self): return 'Basic move: '+ 'Quick Attack' def _str_(self): return "Name: " + self.name + ", HP: " + str(self.hit_point) + ", Weakness: " + self.weakness ---Basic Info: print('\n------. pk = PokemonBasic() print(pk) print(pk.get_type()) print(pk.get_move()) ') --- Pokemon 1 Info:- print('\n------ charmander = PokemonExtra('Charmander', 39, 'Water', 'Fire') print(charmander) print(charmander.get_type()) print(charmander.get_move()) ------') print('\n---- charizard = PokemonExtra('Charizard', 78, 'Water', 'Fire', 'Flying', ('Fire Spin', 'Fire Blaze')) print(charizard) print(charizard.get_type()) print(charizard.get_move()) ---Pokemon 2 Info:-- ------')
Chapter9: Using Classes And Objects
Section: Chapter Questions
Problem 2CP
Related questions
Question
Solve using Python3 and inheritance method
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 3 steps with 3 images
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage