BMI Calculator: Calculate Your Body Mass Index Online
import streamlit as st
st.title('BMI Calculator')
height = st.number_input('Enter your height (in cm)') weight = st.number_input('Enter your weight (in kg)')
if st.button('Calculate BMI'): bmi = weight / ((height/100)**2) st.write('Your BMI is:', round(bmi, 2))
if bmi < 18.5:
    st.write('You are underweight')
elif bmi >= 18.5 and bmi < 24.9:
    st.write('You are normal weight')
elif bmi >= 24.9 and bmi < 29.9:
    st.write('You are overweight')
else:
    st.write('You are obese')
原文地址: https://www.cveoy.top/t/topic/g70u 著作权归作者所有。请勿转载和采集!