Repository navigation
Expand file tree
/
Copy pathpokemon_classes.py
More file actions
56 lines (44 loc) · 1.49 KB
/
Copy pathpokemon_classes.py
File metadata and controls
56 lines (44 loc) · 1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
class Pokemon:
# Parameterized constructor
def __init__(self, name, pokemon_type, weakness, color):
self.name = name # Initializes the 'name' attribute
self.pokemon_type = pokemon_type
self.weakness = weakness
self.color = color
print(
f"{self.name} is a {self.pokemon_type} type which is weak aganist {self.weakness}!"
)
self.personality = Personality()
def attack(self):
if self.name == "Bisharp":
print("Bisharp kills Gengar")
else:
print("Gengar dies to Bisharp")
def shiny(self):
if self.color == "Blue" or self.color == "White":
print("This is a shiny")
else:
print("This is not a shiny")
class Personality:
def __init__(self):
is_kind = input("Are you kind? ")
print("Artist is kind?, " + is_kind)
is_smart = input("Are you smart? ")
is_adventurous = input("Are you adventorus? ")
is_funny = input("Are you funny? ")
class Bisharp(Pokemon):
def __init__(self):
super().__init__("Bisharp", "Dark", "Electric", "Blue")
class Gengar(Pokemon):
def __init__(self):
super().__init__("Gengar", "Ghost", "Dark", "Purple")
# def bark(self):
# print("Woof!")
# Creating an instance of the class calls the __init__ method automatically
my_gengar = Gengar()
my_gengar.attack()
my_gengar.shiny()
my_bisharp = Bisharp()
my_bisharp.attack()
my_bisharp.shiny()
# my_dog.bark()