abdouramandalil commited on
Commit
bac3e9c
1 Parent(s): acdf624

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +35 -0
app.py ADDED
@@ -0,0 +1,35 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+
3
+ st.title('Welcome to the BMI Calculator')
4
+
5
+ weight = st.number_input('Enter your weight in Kgs')
6
+ status = st.radio('Select your height format:',('cms','meters','feet'))
7
+
8
+ try:
9
+ if status == 'cms':
10
+ height = st.number_input('Centimeters')
11
+ bmi = weight/((height/100)**2)
12
+
13
+ elif status == 'meters':
14
+ height = st.number_input('meters')
15
+ bmi = weight/((height)**2)
16
+
17
+ elif status == 'feet':
18
+ height = st.number_input('feet')
19
+ bmi = weight/((height/3.28)**2)
20
+ except:
21
+ print('Zero Division Error')
22
+
23
+ if (st.button('Calculate BMI')):
24
+ st.write('Your BMI index is {}.'.format(round(bmi)))
25
+
26
+ if (bmi<16):
27
+ st.error('You are extremely Underweight')
28
+ elif (bmi >=16 and bmi<18.5):
29
+ st.warning('You are Underweight')
30
+ elif (bmi>=18.5 and bmi<25):
31
+ st.success('Healthy')
32
+ elif (bmi>=25 and bmi<30):
33
+ st.warning('Overweight')
34
+ elif (bmi>=30):
35
+ st.error('Extremely overweight')