In: Computer Science
Working with Python. I am trying to make my code go through each subject in my sample size and request something about it. For example, I have my code request from the user to input a sample size N.
If I said sample size was 5 for example, I want the code to ask the user the following:
"Enter age of subject 1"
"Enter age of subject 2"
"Enter age of subject 3"
"Enter age of subject 4"
"Enter age of subject 5"
#for printing source code:
sample_size=5
for i in range(1,sample_size+1,1):
print("Enter age of subject "+str(i))
#it takes user input too source code
sample_size=5
for i in range(1,sample_size+1,1):
n=int(input("Enter age of subject "+str(i)+": "))
#if you have any doubt or more information needed comment below..i will respond as possible as soon..thanks..