2894. Divisible and Non-divisible Sums Difference

You are given positive integers n and m.

Define two integers as follows:

Return the integer num1 - num2.

Example 1:

Input: n = 10, m = 3
Output: 19
Explanation: In the given example:

Example 2:

Input: n = 5, m = 6
Output: 15
Explanation: In the given example:

Example 3:

Input: n = 5, m = 1
Output: -15
Explanation: In the given example:

def differenceOfSums(self, n: int, m: int) -> int:
	num1, num2 = 0, 0
	for i in range(1,n+1):
		if i % m != 0:
			num1 += i
		else:
			num2 += i
	return num1 - num2