Need explanation of output

result = 0
for count in range(4):
result = result + count

print(result)

output:

6 #Why???

0 + 1 + 2 + 3 == 6

Recall that the upper bound is exclusive.

3 Likes