ok ... first i had to make a function that tells you if the number you choose is a magic number or not ....(perfect number) ... i figured that out
now i have to make a function that prints the magic number ...
The second function, called print_magic, has a single parameter Num. It prints all magic numbers between 2 and Num ..... im haven trouble with telling python to print the numbers between 2 and Num
if i was to call it ... it looks like this
>>>print_magic(100)
6, 28
im jus learning how to use the accumulator but i still need sum work lol ...can sum one help me?
def magic(N):
acc = 0
for i in range(1, N):
if (N % i == 0):
factor = i
acc += factor
if (acc == N):
print ("True")
else:
print ("False")
def print_magic(Num):
acc = 0
for i in range(Num):
factor = i
acc = acc + Num % i == 0
return acc