for x in range(-50,50):
if 50 % x == 0:
a.append(x)
For a homework question, I have to create a function that will find all the numbers between -50 and 50 that divide into 50 (e.g. 1,2,5,10..) However I run into ZeroDivisionError: integer division or modulo by zero, when I try to run this. If I try it then with x % 50 == 0: it works, but its returning numbers divisible by 50, which isn't what I want.
Any ideas how I could fix this up?