Write a loop to populate the list user_guesses with a number of guesses. The variable num_guesses is the number of guesses the user will have, which is read first as an integer. Read integers one at a time using int(input()). Sample output with input: '3 9 5 2' user_guesses: [9, 5, 2]

Respuesta :

Answer:

num_guesses = int(input())

user_guesses = []

for i in range(num_guesses):

    x = int(input())

    user_guesses.append(x)

   

print(user_guesses)

Explanation:

This solution is provided in Python

This line prompts the user for a number of guesses

num_guesses = int(input())

This line initializes an empty list

user_guesses = []

This loop lets user input each guess

for i in range(num_guesses):

This line takes user input for each guess

    x = int(input())

This appends the input to a list

    user_guesses.append(x)

This prints the user guesses    

print(user_guesses)