+ 1

Why is the answer 8

for i in range(0,2): for i in range(0,4): print(i)

30th Sep 2019, 5:27 AM
Jiani Li
Jiani Li - avatar
3 Réponses
+ 8
If the print(i) is in the inner loop, the output should be the following 8 numbers: 0 1 2 3 0 1 2 3 Perhaps the original question was asking how many numbers will be printed? This would be 8. The outer for loop will iterate 2 times and the inner loop will iterate 4 times for each outer loop . Therefore, 2 * 4 is 8.
30th Sep 2019, 6:49 AM
David Carroll
David Carroll - avatar
+ 3
Ahhhhhhhhh the question is how many numbers will this code output? I didn't see.....Thank you so much!!!
30th Sep 2019, 6:52 AM
Jiani Li
Jiani Li - avatar
+ 1
The game answer is 8. I can't understand
30th Sep 2019, 6:42 AM
Jiani Li
Jiani Li - avatar