Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
# OpenBootCampPython
Repository to store Python boot camp.

* Exercise 3: Escribe un programa en la consola de python que pida al usuario su peso (en kg) y estatura (en metros), calcule el índice de masa corporal y lo almacene en una variable, e imprima por pantalla la frase Tu índice de masa corporal es donde es el índice de masa corporal calculado redondeado con dos decimales.

* Screenshot in folder "src/ExerciseThree/imc.png" on branch ExerciseTwo.
3 changes: 3 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
-i https://pypi.org/simple
setuptools==65.5.0 ; python_version >= '3.7'
wheel==0.38.0
Binary file added src/exercisethree/imc.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
10 changes: 10 additions & 0 deletions src/exercisethree/imc.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
def imc(p=0, e=0):
"""Script that calculate the body mass index rounded to two decimal places
:param p: user weigth
:type p: float
:param e: user height float
:type e: float
:return: body mass index rounded to two decimal places
:rtype: float
"""
return round(p/(e*e), 2)
15 changes: 15 additions & 0 deletions src/main.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
from src.exercisethree.imc import imc


def main():
"""Main script for exercise three
:return: None
:rtype: NoneType
"""
p = float(input('Indique su peso (kg): '))
e = float(input('Indique su estatura (m): '))
print("Tu indice de masa corporal es de " + str(imc(p, e)))


if __name__ == '__main__':
main()