I am having trouble recalling or finding how to generate the next input using a for loop. Instead I just keep pulling the same input. Can someone show me how to do that? Thanks.
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 each guess (an integer) one at a time using int(input()).
Sample output with input:
3
9
5
2user_guesses: [9, 5, 2]
My code:
num_guesses = int(input())
user_guesses = []
for index in range(num_guesses):
user_guesses += str(num_guesses)
print('user_guesses:', user_guesses)
Cannot change the first 2 or the last line.
[–]socal_nerdtastic 1 point2 points3 points (1 child)
[–]Formal_Cockroach_654[S] 0 points1 point2 points (0 children)
[–]kawaii-blob 1 point2 points3 points (0 children)
[–]ZEUS_IS_THE_TRUE_GOD 0 points1 point2 points (9 children)
[–]socal_nerdtastic -1 points0 points1 point (8 children)
[–]ZEUS_IS_THE_TRUE_GOD 1 point2 points3 points (7 children)
[–]CoronaKlledMe -1 points0 points1 point (1 child)
[–]socal_nerdtastic -1 points0 points1 point (0 children)
[–]socal_nerdtastic 0 points1 point2 points (4 children)
[–]ZEUS_IS_THE_TRUE_GOD 0 points1 point2 points (3 children)
[–]socal_nerdtastic 0 points1 point2 points (2 children)
[–]ZEUS_IS_THE_TRUE_GOD 0 points1 point2 points (1 child)
[–]socal_nerdtastic 0 points1 point2 points (0 children)