-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestTechnicalPython_4.py
More file actions
36 lines (24 loc) · 1015 Bytes
/
testTechnicalPython_4.py
File metadata and controls
36 lines (24 loc) · 1015 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):
""" APARTADO 4) """
def __init__(self, nombre, edad, departamento = 'Data', puesto = 'Analyst'):
Persona.__init__(self,nombre,edad)
self.departamento = departamento
self.puesto = puesto
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 4) """
nombre = 'Alberto'
trabajador = Trabajador(nombre, 20)
print("Presentation: ", type(trabajador))
trabajador.presentation()