-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPOO_reto.py
More file actions
31 lines (20 loc) · 776 Bytes
/
POO_reto.py
File metadata and controls
31 lines (20 loc) · 776 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
class Person:
def __init__(self, name, surname, age, height, weight):
self.name = name
self.surname = surname
self.age = age
self.height = height
self.weight = weight
def get_name(self):
print(f'El nombre completo es: {self.name} {self.surname}')
def indice_masa (self):
imc= (self.weight / (self.height ** 2))
print(f'El índe de masa corporal de {self.name} {self.surname} es: {imc:.3f}')
name = input('Ingresa tu nombre: ')
surname = input('Ingresa tu apellido: ')
age = int(input('Ingresa tu edad: '))
height = float(input('Ingresa tu altura: '))
weight = float(input('Ingresa tu peso: '))
person = Person(name, surname, age , height, weight)
person.get_name()
person.indice_masa()