Oceane22 commited on
Commit
d41e173
1 Parent(s): fa5a36d

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -0
app.py ADDED
@@ -0,0 +1,33 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ st.title('Welcome to BMI Calculator')
3
+
4
+ weight = st.number_input('Enter your weight in Kgs')
5
+
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
+ elif status == 'meters':
13
+ height = st.number_input('meters')
14
+ bmi = weight/((height)**2)
15
+ elif status == 'feet':
16
+ height = st.number_input('feet')
17
+ bmi = weight/((height/3.28)**2)
18
+ except:
19
+ print('Zero Division error')
20
+
21
+ if (st.button('Calculate BMI')):
22
+ st.write('Your BMI Index is {}.'.format(round(bmi)))
23
+
24
+ if (bmi<16):
25
+ st.error('You are extremly underweight')
26
+ elif (bmi>=16) and (bmi<18.5):
27
+ st.warning('You are underweight')
28
+ elif (bmi>=18.5) and (bmi<23):
29
+ st.success('You are Healthy')
30
+ elif (bmi>=23) and (bmi<30):
31
+ st.warning('You are overweight')
32
+ elif (bmi>30):
33
+ st.error('You are extremly overweight')