Write a loop to populate the list user_gusses 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 each guess (an integer) one at a time using int(input())
Sample output with input
3 9 5 2
user_gusses: [9, 5, 2]
num_guesses= int(input())
user_guesses= []
#ask user to enter the user_guesses element
for i in range(0, num_guesses):
x= int(input())
user_guesses.append(x)
print('user_guesses:', user_guesses)
Hope this is helpful. Write back to me in case you need help with your python task. I generally reply back within 24 hours. You can connect with me on Whatsapp also: +918602715108
Comments
Post a Comment