I don't get this multiplication function

What does for count in range(0, num_2): mean? Or rather how does it work?

`def multiplication(num_1, num_2):
  result = 0
  for count in range(0, num_2):
    result += num_1
  return result`

The function demonstrates how multiplication is actually just repeated addition. We add num_1 to itself num_2 times.

5 * 7

7 + 7 + 7 + 7 + 7 == 35
5 + 5 + 5 + 5 + 5 + 5 + 5 == 35
1 Like