For this task, you are to write code that calculates the average age of family members. Instructions Your program should ask the user to input a number of family members. The program should then...


python only
start from here:



def ask_for_age():

    age = int(input('Enter the age of a family member: '))

    return age


For this task, you are to write code that calculates the average age of family members.<br>Instructions<br>Your program should ask the user to input a number of family members. The program should then repeatedly ask the user to input the age of a<br>family member until the specified number of family members is reached. Finally, the program should output the average age of the family<br>members based on the input values.<br>Hint: consider which form of aggregation might be appropriate for solving this problem.<br>If the user inputs zero for the number of family members, the program should output a friendly message informing the user that at least 1<br>family member is required.<br>A function has already been defined for you which asks the user for the age of a family member. You must use this function as part of your<br>solution.<br>

Extracted text: For this task, you are to write code that calculates the average age of family members. Instructions Your program should ask the user to input a number of family members. The program should then repeatedly ask the user to input the age of a family member until the specified number of family members is reached. Finally, the program should output the average age of the family members based on the input values. Hint: consider which form of aggregation might be appropriate for solving this problem. If the user inputs zero for the number of family members, the program should output a friendly message informing the user that at least 1 family member is required. A function has already been defined for you which asks the user for the age of a family member. You must use this function as part of your solution.

Jun 04, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here