Skip to content

Instantly share code, notes, and snippets.

@Sustainability4
Created July 27, 2020 06:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Sustainability4/1706425ef3baca1c3efd69e8733e1fb9 to your computer and use it in GitHub Desktop.
Save Sustainability4/1706425ef3baca1c3efd69e8733e1fb9 to your computer and use it in GitHub Desktop.
BMI calculator .ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "BMI calculator .ipynb",
"provenance": [],
"authorship_tag": "ABX9TyOrVCu8RtfI5L7ouDQYbLYm",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/Sustainability4/1706425ef3baca1c3efd69e8733e1fb9/bmi-calculator.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "code",
"metadata": {
"id": "FkRcQ47btCVC",
"colab_type": "code",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 153
},
"outputId": "60866f05-8a19-49c9-a502-eaf11f5720f5"
},
"source": [
"print(\"Find out my BMI\")\n",
"weight_kg = input(\"Enter your weight (in Kgs)\")\n",
"weight_kg = float(weight_kg)\n",
"height_unit = input(\"What is the preferred unit of height? Type 'M' for metre and 'F' for feet\")\n",
"if height_unit == \"F\" : \n",
" height_Feet = input(\"You will enter your height as feet and inches. First enter feet\")\n",
" height_Inches = input(\"Now enter inches\")\n",
" height_Feet = int(height_Feet)\n",
" height_Inches=int(height_Inches)\n",
" height_metre = height_Feet * 0.3048 + height_Inches * 0.0254\n",
"if height_unit == \"M\":\n",
" height_metre = input(\"what is your height in metres\")\n",
" height_metre = float(height_metre)\n",
"height_metre_square = height_metre ** 2\n",
"BMI = weight_kg/height_metre_square\n",
"print(BMI)\n",
"if BMI<18.5 :\n",
" print(\"Underweight\")\n",
" weight_target = str(18.5 * height_metre_square)\n",
" print(\"Your Target Weight is\" + weight_target)\n",
"if 18.5<=BMI<25:\n",
" print(\"Normal\")\n",
" print(\"Great!! remain where you are\")\n",
"if 30>BMI>=25 : \n",
" print(\"Overweight\")\n",
" weight_target = str(24.9 * height_metre_square)\n",
" print(\"Your Target Weight is\" + weight_target)\n",
"if BMI>30 :\n",
" print(\"very overweight\")\n",
" weight_target = str(25 * height_metre_square)\n",
" print(\"Your Target Weight is\" + weight_target)\n",
"\n",
"\n",
"\n",
" \n",
"\n"
],
"execution_count": 30,
"outputs": [
{
"output_type": "stream",
"text": [
"Find out my BMI\n",
"Enter your weight (in Kgs)88\n",
"What is the preferred unit of height? Type 'M' for metre and 'F' for feetF\n",
"You will enter your height as feet and inches. First enter feet5\n",
"Now enter inches11\n",
"27.05817750457164\n",
"Overweight\n",
"Your Target Weight is80.98106384399998\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "MdEL6J8CvbWc",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": null,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment