I'm new to python or coding in general. And encountered some while loop question in the following code.
a = int(input('input a number here: '))
def largest_factor(x):
factor = x - 1
while factor > 0:
if x % factor == 0:
return factor
factor -= 1
print(factor)
largest_factor(a)
I'm using python 3.5, and in my understanding, the loop will not break until 0 > 0, so I put the print(factor) to exam that, however, it stopped at the largest factor(e.g. when x = 100, factor prints from 99 all the way to 50, and stopped), and did not reach 0. Is the return statement killed the while loop? Thank you for your time.