I don't understand this, what does this do?
def func(x): res = 0 for i in range(x): res += i return res print(func(4))
Maybe python would be a good tag for the question.
func(x) gives the sum of numbers from 0 to x-1.
For future reference, please tag a relevant language to improve context clarity ... ☝