%matplotlib inline
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
def bmi_cal(h, w):
h = float(h)/100
w = float(w)
bmi = w/(h**2)
message = f"你的 BMI 是 {bmi:.2f}。"
print(message)
bmi_cal(170, 80)
你的 BMI 是 27.68。
from ipywidgets import interact_manual
interact_manual(bmi_cal, h="請輸入你的身高 (公分)", w="請輸入你的體重 (公斤)");
interactive(children=(Text(value='請輸入你的身高 (公分)', description='h'), Text(value='請輸入你的體重 (公斤)', description='w')…