Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

class Pokemon: 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.") 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()

Output

Pokemon: Pikachu Type: Electric Weakness: Ground I am a Pokemon. I am Pikachu. ======================== Pokemon: Charmander Type: Fire Weakness: Water, Ground and Rock I am a Pokemon. I am Charmander.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions