Advertisement
adaptingear

Arreglar

Oct 11th, 2019
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.80 KB | None | 0 0
  1. class persona():
  2.     nombre = ""
  3.     edad = 0
  4.     DNI = 0
  5.     sexo = ""
  6.     peso = 0.0
  7.     altura = 0.0
  8.  
  9.     def __init__(self):
  10.         self.nombre = "Hernan"
  11.         self.edad = 19
  12.  
  13.     def defecto2(self):
  14.         self.nombre = "Hernan"
  15.         self.edad = 19
  16.         self.sexo = "M"
  17.  
  18.     def skere(self, nombre, edad, DNI, sexo, peso, altura):
  19.         self.nombre = nombre
  20.         self.edad = edad
  21.         self.DNI = DNI
  22.         self.sexo = sexo
  23.         self.peso = peso
  24.         self.altura = altura
  25.  
  26.     def valores(self):
  27.         return self.nombre
  28.         return self.edad
  29.         return self.DNI
  30.         return self.sexo
  31.         return self.peso
  32.         return self.altura
  33.        
  34.     def obtenerdatos(self):
  35.             while True:
  36.                 print("-----MENU-----\n")
  37.                 print("1. AGREGAR DATOS")
  38.                 print("2. MOSTRAR DATOS")
  39.                 print("3. SALIR")
  40.                 opcion = input("Seleccione una opcion: ")
  41.                 if(opcion=="1"):                
  42.                     a = input("Nombre: ")
  43.                     b = input("Edad: ")
  44.                     c = input("DNI: ")
  45.                     d = input("Sexo: ")
  46.                     e = input("Peso: ")
  47.                     f = input("Altura: ")
  48.                     self.skere(a,b,c,d,e,f)
  49.                 elif(opcion=="2"):
  50.                     print(self.valores(a))
  51.                     print(self.valores(b))
  52.                     print(self.valores(c))
  53.                     print(self.valores(d))
  54.                     print(self.valores(e))
  55.                     print(self.valores(f))
  56.  
  57.                 elif(opcion=="3"):
  58.                     break
  59.                 else:
  60.                     print("Opcion incorrecta")
  61.  
  62. clase = persona()
  63. clase.obtenerdatos()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement