Implement the design of the Pikachu and Charmander classes that are derived from the Pokemon class so that the following output is produced: Driver Code Output class Pokemon: Pokemon: Pikachu Туре: Electric Weakness: Ground I am a Pokemon. I am Pikachu. def _init_(self, p): self.pokemon = p self.pokemon_type = "Needs to be set" self.pokemon_weakness = "Needs to be set" def kind(self): return self.pokemon_type def weakness(self): return self.pokemon_weakness def what_am_i(self): print("I am a Pokemon.") ===== Pokemon: Charmander Туре: Fire Weakness: Water, Ground and Rock I am a Pokemon. I am Charmander. pk1 = Pikachu() print("Pokemon:", pk1.pokemon) print("Type:", pk1.kind()) print("Weakness:", pk1.weakness()) pk1.what_am_i() print("======== c1 = Charmander() print("Pokemon:", c1.pokemon) print("Type:", c1.kind()) print("Weakness:", c1.weakness()) |c1. what_am_i() ==")
Implement the design of the Pikachu and Charmander classes that are derived from the Pokemon class so that the following output is produced: Driver Code Output class Pokemon: Pokemon: Pikachu Туре: Electric Weakness: Ground I am a Pokemon. I am Pikachu. def _init_(self, p): self.pokemon = p self.pokemon_type = "Needs to be set" self.pokemon_weakness = "Needs to be set" def kind(self): return self.pokemon_type def weakness(self): return self.pokemon_weakness def what_am_i(self): print("I am a Pokemon.") ===== Pokemon: Charmander Туре: Fire Weakness: Water, Ground and Rock I am a Pokemon. I am Charmander. pk1 = Pikachu() print("Pokemon:", pk1.pokemon) print("Type:", pk1.kind()) print("Weakness:", pk1.weakness()) pk1.what_am_i() print("======== c1 = Charmander() print("Pokemon:", c1.pokemon) print("Type:", c1.kind()) print("Weakness:", c1.weakness()) |c1. what_am_i() ==")
Chapter11: Advanced Inheritance Concepts
Section: Chapter Questions
Problem 5PE
Related questions
Question
Solve using Python3 and Inheritance method
![Task – 9
Implement the design of the Pikachu and Charmander classes that are derived from
the Pokemon class so that the following output is produced:
Driver Code
Output
class Pokemon:
Pokemon: Pikachu
Туре: Electric
def _init_(self, p):
self.pokemon = p
self.pokemon_type = "Needs to be set"
self.pokemon_weakness = "Needs to be set"
def kind(self):
return self.pokemon_type
def weakness(self):
return self.pokemon_weakness
def what_am_i(self):
print("I am a Pokemon.")
Weakness: Ground
I am a Pokemon.
I am Pikachu.
Pokemon: Charmander
Туре: Fire
Weakness: Water, Ground and Rock
I am a Pokemon.
I am Charmander.
pk1 = Pikachu()
print("Pokemon:", pk1.pokemon)
print("Type:", pk1.kind())
print("Weakness:", pk1.weakness())
pk1.what_am_i()
print ("=======:
c1 = Charmander()
print ("Pokemon:", c1.pokemon)
print ("Type:", c1.kind())
print ("Weakness:", c1.weakness())
c1. what_am_i()
=")](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F5ede3a15-31ca-4ccd-8c31-31b481438dd6%2F8564fab6-a4cc-4671-8763-13879eb92521%2Ffhev0f3_processed.png&w=3840&q=75)
Transcribed Image Text:Task – 9
Implement the design of the Pikachu and Charmander classes that are derived from
the Pokemon class so that the following output is produced:
Driver Code
Output
class Pokemon:
Pokemon: Pikachu
Туре: Electric
def _init_(self, p):
self.pokemon = p
self.pokemon_type = "Needs to be set"
self.pokemon_weakness = "Needs to be set"
def kind(self):
return self.pokemon_type
def weakness(self):
return self.pokemon_weakness
def what_am_i(self):
print("I am a Pokemon.")
Weakness: Ground
I am a Pokemon.
I am Pikachu.
Pokemon: Charmander
Туре: Fire
Weakness: Water, Ground and Rock
I am a Pokemon.
I am Charmander.
pk1 = Pikachu()
print("Pokemon:", pk1.pokemon)
print("Type:", pk1.kind())
print("Weakness:", pk1.weakness())
pk1.what_am_i()
print ("=======:
c1 = Charmander()
print ("Pokemon:", c1.pokemon)
print ("Type:", c1.kind())
print ("Weakness:", c1.weakness())
c1. what_am_i()
=")
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 5 steps with 3 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
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
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
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#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,
![EBK JAVA PROGRAMMING](https://www.bartleby.com/isbn_cover_images/9781337671385/9781337671385_smallCoverImage.jpg)
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#](https://www.bartleby.com/isbn_cover_images/9781337102100/9781337102100_smallCoverImage.gif)
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,