Create a Python program to determine the body-mass index of a collection of six individuals. Your program should prompt for a list of six names first. Then, using a for loop, it should successively prompt the user for the height in inches and weight in pounds of each individual. Each prompt should display the name of the individual whose height and weight is to be input. Validate that input for height and weight are positive (using a loop). It should call a function that accepts the height and weight as parameters and returns the body mass index for that individual using the formula: BMindex = weight × 703 / height2. (eg. 200lb, 6ft(72in) would be: BMindex = (200*703)/(72*72) = 27.1219 ). That body mass index should then be appended to a 2nd "parallel" array. Using another loop it should traverse the array of body mass indices and call another function that accepts the body mass index as a parameter and returns whether the individual is underweight, normal weight or overweight. The number of individuals in each category should be counted and displayed. The Main program should only have function calls. All the code is actually in the functions with arguments and returns. No globals. Design you functions carefully. Note: at least three loops and at least three (maybe as many as 6 or 7) functions.   def get_name_height_weight(): #lists for name and bmi name_list = [] bmi_list = [] for i in range(6): #input name and append to list name = input("Enter name : ") name_list.append(name) #input height and weight and validate if it is positive height = float(input("Enter height in inch : ")) if height<0: print("invalid height for", name[i]) weight = float(input("Enter weight in pounds : ")) if weight<0: print("invalid weight for", name[i]) return(name, height, weight)   #function to calculate BMI def get_BMI(height,weight): bmi = weight * 703 / height**2 return(bmi) def get_bmi_status(bmi): if(bmi < 18.5): print('Underweight') elif(bmi >= 18.5 and bmi < 25): print('Normal') else: print('Overweight') # The number of individuals in each category should be counted and displayed. bmi_status = [] all_bmi =[] for bmi in all_bmi: bmi_status.append(bmi) categories = ['Underweight','Normal','Overweight'] for category in categories: count = 0 for bmi_status in range(6): if(bmi == category): count = count + 1 print('For the category',category,'the number of individuals are: ',count)    def main(): myName names,height,weight = get_name_height_weight() bmi = get_BMI(height,weight) count = get_bmi_status(bmi)

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

My program isn't performing the calculation please help. Below is the assignment and the program I am working on. Im hoping that the program I included can be fixed rather than a brand new program. But I will accept all the help you can give me 

 

 

Create a Python program to determine the body-mass index of a collection of six individuals. Your program should prompt for a list of six names first. Then, using a for loop, it should successively prompt the user for the height in inches and weight in pounds of each individual. Each prompt should display the name of the individual whose height and weight is to be input. Validate that input for height and weight are positive (using a loop). It should call a function that accepts the height and weight as parameters and returns the body mass index for that individual using the formula: BMindex = weight × 703 / height2. (eg. 200lb, 6ft(72in) would be: BMindex = (200*703)/(72*72) = 27.1219 ). That body mass index should then be appended to a 2nd "parallel" array. Using another loop it should traverse the array of body mass indices and call another function that accepts the body mass index as a parameter and returns whether the individual is underweight, normal weight or overweight. The number of individuals in each category should be counted and displayed. The Main program should only have function calls. All the code is actually in the functions with arguments and returns. No globals. Design you functions carefully. Note: at least three loops and at least three (maybe as many as 6 or 7) functions.

 

def get_name_height_weight():
#lists for name and bmi
name_list = []
bmi_list = []
for i in range(6):
#input name and append to list
name = input("Enter name : ")
name_list.append(name)
#input height and weight and validate if it is positive
height = float(input("Enter height in inch : "))
if height<0:
print("invalid height for", name[i])
weight = float(input("Enter weight in pounds : "))
if weight<0:
print("invalid weight for", name[i])
return(name, height, weight)
 

#function to calculate BMI
def get_BMI(height,weight):
bmi = weight * 703 / height**2
return(bmi)


def get_bmi_status(bmi):
if(bmi < 18.5):
print('Underweight')
elif(bmi >= 18.5 and bmi < 25):
print('Normal')
else:
print('Overweight')

# The number of individuals in each category should be counted and displayed.
bmi_status = []
all_bmi =[]
for bmi in all_bmi:
bmi_status.append(bmi)
categories = ['Underweight','Normal','Overweight']
for category in categories:
count = 0
for bmi_status in range(6):
if(bmi == category):
count = count + 1
print('For the category',category,'the number of individuals are: ',count)
  
def main():
myName
names,height,weight = get_name_height_weight()
bmi = get_BMI(height,weight)
count = get_bmi_status(bmi)

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education