Question: Write a program in python languages that calculates the average heights of an indefinite number of males and females. The program should prompt the user
Write a program in python languages that calculates the average heights of an indefinite number of males and females.
The program should prompt the user to enter the height of each person.
The program should also ask the user to enter if that person is a male or female:
o Create an error trap (validation loop) that validates whether the user entered a correct gender value (F or M). If not, keep prompting the user to enter a valid gender value until they do so.
The program should terminate when the user enters a non-positive number (0 or less), instead of entering a valid height.
 After the user enters all persons’ heights and genders,o Display the total number of males
o Display the average height of males
o Display the total number of femaleso Display the average height of females
NOTE: Create at least 4 variables that keep track of the total number of males, the total number of females, the total height of all males, and the total height of all females. Initialize them to zero at the start of your program.
Step by Step Solution
There are 3 Steps involved in it
4 mainpy 2 3 4 Run Debug Stop printEnter the heights and gender when prompted enter or neg... View full answer
Get step-by-step solutions from verified subject matter experts
