Answer
No, you can't always convert any whole loop into a for loop. When we are using a while loop, we don't always know the number of times we will loop through. But, in this case, we were given the value 10000, so we are able to convert this while loop into a for loop.
Work Step by Step
i = 1
sum = 0
for sum in range(10000):
sum = sum + i
i += 1