PFP191_-_SU_2024_-_FE_2357.webp
T

PFP191_-_SU_2024_-_FE_2357.webp

Kizspy | Question: 3
(Choose 1 answer)
class Pokemon():
def_init__(self, name, type):self.name = name
self.type = type
def stringPokemon(self):print(f"Pokemon name is {self.name} and type is {self.type}")
class Grass Type(Pokemon):
# overrides the stringPokemon() function on 'Pokemon' class
def stringPokemon(self):
print(f"Grass type pokemon name is {self.name}")
poke1 = Grass Type('Bulbasaur', 'Grass')
poke1.stringPokemon
poke1.stringPokemon()
poke2 = Pokemon('Charizard', 'Fire')
poke2.stringPokemon
poke2.stringPokemon()
A. Grass type pokemon name is Bulbasaur Pokemon name is Charizard and type is Fire
B. Pokemon name is Bulbasaur and type is Grass Pokemon name is Charizard and type is Fire
C. Grass type pokemon name is Bulbasaur Grass type pokemon name is Charizard
D. Error because the extending class has a stringPokemon() function which already exists.

Thông tin

Category
PFP191
Thêm bởi
thanhphu2003
Ngày thêm
Lượt xem
1,514
Lượt bình luận
5
Rating
0.00 star(s) 0 đánh giá

Share this media

Back
Bên trên Bottom