i am beginner in python . I have created a file series.py which has class name Modulus . Under which there is function defined name mod. it return all divisible number till 100. i am calling this function from another python file name newone.py.
series.py
#!/usr/local/bin/python3
class Modulus:
def mod(inp):
list1 = list(range(1,101))
#print(list)
list2 = []
for num in list1:
abc = num % inp
if ( abc == 0 ):
list2.append(num)
return list2
And
newone.py
#!/usr/local/bin/python3
from series import Modulus
inp = int(input("Please enter number from 1-10:"))
obj = Modulus()
result = obj.mod(inp)
print(result)
i am trying to get return value in result varible. But when i try to print this variable i got error as below.
Please enter number from 1-10:4
Traceback (most recent call last):
File "./newone.py", line 7, in <module>
result = obj.mod(inp)
TypeError: mod() takes 1 positional argument but 2 were given
i am not getting where i am wrong . Please help me out.