0
How is the answer 6?
i = 0 x=0 while i<4: x+=i i+=1 print(x) # i don't understand how the answer is 6, anyone please help me.
3 Answers
+ 2
1st round. x+=i, i+=1 // x = 1, i =1
2nd round. x+=i(1), i+=1 // x = 2, i =2
3rd round. x+=i(2), i+=1 // x = 3, i = 3
4th round. x+=1(3), i+=1 // x = 6, i =4
+ 2
Because, x is increased by 1, then 2, and finally 3.
0
Its gonna take some time for me to process it. Thanks btw