I have this class code that runs without any problem, I want to do the data entry using input
function and then visualize it with print
or return
, but I could not do it, it is unconfigured when I try.
I would appreciate guidance on the subject. How can I achieve it?
#SuperClase, Clase Padre(esto se convierte en programacion en capas)
class Persona:
def __init__(self, clv, nom, ed):
self.clave = clv
self.nombre = nom
self.edad = ed
def mostrarDatos(self,):
print("Mostrando los Datos desde la SuperClase")
print("CLAVE: ", self.clave)
print("NOMBRE: ", self.nombre)
print("EDAD: ", self.edad)
#CON ESTO CREAMOS LA HERENCIA
class Trabajador(Persona):
def __init__(self, clv, nom, ed, suel):
self.clave = clv
self.nombre = nom
self.edad = ed
self.sueldo = suel
def mostrarDatos(self,):
print("____________________________________")
print("Mostrando los Datos desde la SubClase")
print("CLAVE: ", self.clave)
print("NOMBRE: ", self.nombre)
print("EDAD: ", self.edad)
print("SUELDO: ", self.sueldo)
# creando instancias (Objetos)
Administrador = Persona("AAMM45", "elias PARAMO", 35)
Empleado = Trabajador("AAMM45", "PEDRO PARAMO", 35, 2350500)
Administrador.mostrarDatos()
Empleado.mostrarDatos()