I want to be able to ask the user to input the number of participants in a sample size, and enter the maximum and minimum age of the participants. Next I want the code to randomly assign to EACH participant: gender (1 for male, 2 for female), and age of the participant. The program should then display the total number of male and female participants separately along with their average age.
I am a novice in Python so I have been searching up and down the web for how to assign the gender (1 or 2) to each number in the study. I can split the sample size into a list but I am confused on how to assign said value to each number, maybe I am just missing a simple function.
num = int(input('Enter the number of participants in the study: '))
max = int(input('Enter the maximum age of the participants: '))
min = int(input('Enter the minimum age of the participants: '))
x = list(range(num+1))
Aucun commentaire:
Enregistrer un commentaire