File size: 994 Bytes
a2c0972
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
32
33
34
35
import streamlit as st 
st.title('Welcome to the BMI Calculator')

weight = st.number_input('Enter your weight in Kgs')
status = st.radio('Select your height format:',('cms','meters','feet'))

try:
    if status == 'cms':
        height = st.number_input('Centimeters')
        bmi = weight/((height/100)**2)

    elif status == 'meters':
        height = st.number_input('meters')
        bmi = weight/((height)**2)

    elif status == 'feet':
        height = st.number_input('feet')
        bmi = weight/((height/3.28)**2)
except:
    print('Zero Division error')

if st.button('Calculate BMI'):
    st.write('Your BMI Index is {}.'.format(round(bmi)))

    if bmi<16:
        st.error('You are extremely underweight')
    elif (bmi>=16 and bmi<18):
        st.warning('You are underweight')
    elif (bmi>=18 and bmi<25):
        st.success('You are Healhy')
    elif (bmi>=25 and bmi<30):
        st.warning('You are Overweight')
    elif bmi>=30:
        st.error('Extremely overweight')