Generation

generate functionThu, 12 Jan 2023

Using height and weight data for five individuals. Using the following formula, determine the BMI index and create programming that shows the height, weight, BMI value, and judgment result. BMI=w/h x h physical=[ [1,1.75,55.0], [2,1.75,65.0], [3,1.75,75.0], [4,1.75,85.0], [5,1.75,95.0]] Less than 18.5 Thin 18.5 to less than 25.0 Standard 25.0 to less than 30.0 Fat More than 30.0 Too Fat

def bmi(h, w): return w/h**2 def standard(bmi): if bmi <18.5: return 'thin' elif bmi <25.0: return 'standard' elif bmi <30.0: return 'fat' else : return 'too fat' for i in physical: bmi_value = bmi(i[1], i[2]) print(f"{i[0]} person's bmi is {bmi_value:.2f}, and he/she is {standard(bmi_value)}")

Questions about programming?Chat with your personal AI assistant