-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathEj13.py
More file actions
117 lines (81 loc) · 2.27 KB
/
Ej13.py
File metadata and controls
117 lines (81 loc) · 2.27 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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
class Animal():
def __init__(self, nom, atributo, edad):
self.nom = nom
self.atributo = atributo
self.edad = edad
def hablar(self):
pass
def moverse(self):
pass
def quien_soy(self):
print("Soy un animal")
class Caballo(Animal):
def hablar(self):
print("iiiiii")
def moverse(self):
print("Me muevo al trote")
def quien_soy(self):
print("Soy un caballo")
class Delfin(Animal):
def hablar(self):
print("ichcich")
def moverse(self):
print("Me muevo nadando")
def quien_soy(self):
print("Soy un delfín")
class Abeja(Animal):
def hablar(self):
print("bzzz")
def moverse(self):
print("Me muevo con alasw")
def quien_soy(self):
print("Soy una abeja")
class Humano(Animal):
def __init__(self, nom, atributo, edad):
self.nom = nom
self.atributo = atributo
self.edad = edad
def hablar(self):
print("Hola")
def moverse(self):
print("Me muevo caminando")
def quien_soy(self):
print("Soy un humano")
class Centauro(Humano, Caballo):
def hablar(self):
print("Hola, nosotros usamos un idioma para hablar")
def moverse(self):
print("Me muevo al trote")
def quien_soy(self):
print("Soy un centauro")
class Hijo(Humano):
def __init__(self, nom, atributo, edad, ll_padres):
self.nom = nom
self.atributo = atributo
self.edad = edad
self.padres = ll_padres
def hablar(self):
print("UeeeU")
def moverse(self):
print("Me muevo gateando")
def quien_soy(self):
print("Soy un hijo")
def nompadres(self):
for e in self.padres:
print(e.nom)
# Ni idea de qué es Xou.
class Xou():
def hablar(self):
print("Xou")
def moverse(self):
print("Me muevo como un xou")
def quien_soy(self):
print("Soy un xou")
# Programa Principal
a = [Caballo("Negro", "5", "10"), Delfin("Gris con blanco", "7", "8"), Abeja("Negro y amarillo", "0.5", "1"),
Humano("Ayoub", "Ahmed", "69"), Centauro("Marc", "Marron", "16"),
Hijo("David", "Albino", "16",["A", "B"]), Xou()]
for e in a:
e.hablar()
e.moverse()
e.quien_soy()