-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTechnicalPython_5.py
More file actions
35 lines (24 loc) · 973 Bytes
/
testTechnicalPython_5.py
File metadata and controls
35 lines (24 loc) · 973 Bytes
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
""" SEGUNDA PARTE PYTHON """
class Persona:
def __init__(self, nombre, edad):
self.nombre = nombre
self.edad = edad
def presentation(self):
return f"Hola! Soy {self.nombre} y tengo {self.edad} años"
def __str__(self):
return f"Hola! Soy {self.nombre} y tengo {self.edad} años"
class Trabajador(Persona):
def __init__(self, list):
Persona.__init__(self, list[0], list[1])
self.departamento = list[2]
self.puesto = list[3]
def presentation(self):
print(Persona.presentation(self),f"pertenezco al departamento: {self.departamento} y mi puesto es {self.puesto}")
def __str__(self):
return f"{Persona.__str__(self)} pertenezco al departamento: {self.departamento} y mi puesto es {self.puesto}"
""" APARTADO 5) """
my_var_list = [ 'Andrea', '42', 'Ventas', 'Manager']
for v in my_var_list:
print(v)
trabajador_2 = Trabajador(my_var_list)
trabajador_2.presentation()