Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

using python, first pictures are directions, then my code with errors, then what the final result should look like how do i make my code

using python, first pictures are directions, then my code with errors, then what the final result should look like
how do i make my code print the actual numbers(average bmi, number of members and highest bmi) instead of the words inside the parenthesis.
pleqse look at my code and see what else i did wrong after looking at directions, thank you so much g
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribed
image text in transcribedmine with errors
image text in transcribedwhat it should look like
The Program For Assignment Two, a couple of new things we need to do. 1. Rewrite the program to create a function that calculates BMI. The function takes in two parameters (weight and height) and returns BMI. 2. Create a second function that determine the level based on BMI. The function takes in one parameter (BMI) and returns corresponding level. 3. If the user enters incorrect input (non-numeric-looking input), your program should stop and provide an explanation. You can decide whether integer or float data type is appropriate. 4. We have a list of people. They are Max, Jack, and Joey. If you like you can make up your own list. Testing data are provided. We would like to go through the list, for each person, we enter information, calculate BMI, and display the level based on their BMI. 5. At the end, we will show a summary, how many people, average BMI, and highest percentage. \#function, calculate bmi given weight and height def calc_bmi (weight, height): bmi=weight 03/ height 2 return round (bm1,2) \#function, calculate BMI level def bmi_level(bm1): if bm >=19 and bmi =26: return( 'OW') \#function, average bmi def avg_bmi(avg_bmi): avgbmi =total_bmi/len(members) return round (avgbmi, 2) *itbegin main component of program print( 'Welcome to Healthy 2023!') \#livariables nembers =[ 'Nax', 'Jack', 'Mary'] total_bmi=0 high_bmi=0 thibegin loop through members with input for member in members: try: weight=float(input ( f Enter Weight for { member }> " )) height=f loat (input ( f Enter Height for { member }>) ) \#tbmi calculation bmi=calc_bmi(weight, height) mbmi level calculation level=bmi_level (bm1) print ( f \{member\} BMI is {bmi} at level of {{evel} ) \#total and highest bmi total bmitebmi if bmi> hioh bmi: Taverage band averagebn1 = total_bad / len(nembers) return averagebmi ssumeary Wezcome to Heatthy 2023 ! Enter Weight for Max 88 Enter Height for Max 12 Nax BNI is 429.61 at level of OW Enter Weight for Jack 9 Enter Height for Jack 56 Jack BNI is 22.19 at level of OK Enter Weight for Mary>787 Enter Height for Mary >67 Mary BMI is 123.25 at level of OW Summary=e Number of members is \{ten(members)\} Average BMI is \{avg_bmi\} Highest BMI is \{high_bmi\} Welcome to Healthy 2023 ! Enter weight for Max>89 Enter height for Max >45 Max BMI is 30.90 at level of OW Enter weight for Jack >105 Enter height for Jack>64 Jack BMI is 18.02 at level of UW Enter weight for Mary>120 Enter height for Mary>62 Mary BMI is 21.95 at level of OK Number of members is 3 Average BMI is 23.62 Highest BMI is 30.90

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions