(iii) The age of employees in two factories A and b are
given below. Find the modal age of employees in factory A
and Factory B
Answers
Answer:
here is your answer
thank you !
Answer:
Python program to find the modal age of employees in Factory A and Factory B, first calculate the mean age for each factory.
Explanation:
From the above question,
They have given :
To find the modal age of employees in Factory A and Factory B, first calculate the mean age for each factory.
For Factory A, the mean age is:
sum_age_A = 0
for age in A:
sum_age_A += age
mean_A = sum_age_A / len(A)
print("The mean age of employees in Factory A is:", mean_A)
For Factory B, the mean age is:
sum_age_B = 0
for age in B:
sum_age_B += age
mean_B = sum_age_B / len(B)
print("The mean age of employees in Factory B is:", mean_B)
Then, count the number of people who have a particular age in each factory. The age that has the highest frequency would be the modal age for each factory.
For Factory A, the modal age is:
age_dict_A = {}
for age in A:
if age not in age_dict_A:
age_dict_A[age] = 1
else:
age_dict_A[age] += 1
max_value = 0
modal_age_A = 0
for age, count in age_dict_A.items():
if count > max_value:
max_value = count
modal_age_A = age
print("The modal age of employees in Factory A is:", modal_age_A)
For Factory B, the modal age is:
Python
agedictB = {}
for age in B:
if age not in agedictB:
agedictB[age] = 1
else:
agedictB[age] += 1
maxvalue = 0
modalageB = 0
for age, count in agedictB.items():
if count > maxvalue:
maxvalue = count
modalage_B = age
For more such related questions : https://brainly.in/question/32667309
#SPJ3