Respuesta :
Answer:
num_guesses = 3 #initialized number of guesses to 3
user_guesses = [] #declared the user_guesses array
guess = 0 #guess variable initialized to 0
print('Enter a number: ') #prompt telling the user to enter a number
while guess < num_guesses: #loop capturing input and storing into array
num = int(input())
user_guesses.append(num)
guess = guess + 1
#end of loop
print(user_guesses) #array outputted to user
Explanation:
The above program captures numbers from the user and stores into an array (user_guesses), the length of the array is determined by the value contained in the num_guesses variable, it prints the combined input as an array.
Loops are code statements that are used to repetitive statements.
The loop in Python where comments are used to explain each line is as follows:
#This gets input for the number of guesses
num_guesses = int(input())
#This initializes a list for user guess
user_guesses = []
#The following is repeated
for i in range(num_guesses):
#This gets input for the guess
num = int(input())
#This adds the guess to a list
user_guesses.append(num)
#This prints all the guesses by the user
print(user_guesses)
Read more about loops at:
https://brainly.com/question/19344465