samedi 27 août 2022

How to find the average weight of a specific gender between 12 people with their own gender, height and weight

The question is implementing that I need to find the average weight of males from a list of 12 people that are males and females. I am not sure what to use since I can't use any other external additions like panda or tables to make it easier. I need to write it in a basic python edition, the 12 people don't have to be random, but I'm not sure if I can use the equations and how do I state multiple arrays with multiple statistics that are merged together, so I used random number, but I can again with the same problem on how do I know which random number is generated to which gender. What I had in mind that I want 12 people with their gender, height and weight and after the make a calculation of the average weight of males in the calculation the people can be input normally in a range or randomly both work, but I'm just not sure how to use the different stuff with each other to find their average weight of males. Here is the code I'm working on It's nothing, but it's maybe an idea to explain in details what I want exactly to do

import random

ranlistgend = []
n = 10
for i in range(n):
    ranlistgend.append(random.randint(1, 2))
print(ranlistgend)

ranlisthei = []
n = 10
for i in range(n):
    ranlisthei.append(random.randint(140, 190))
print(ranlisthei)

ranlistwei = []
n = 10
for i in range(n):
    ranlistwei.append(random.randint(60, 100))
print(ranlistwei)
`



Aucun commentaire:

Enregistrer un commentaire