n=27
m=18
a=list()
min= m if m<n else n
for i in range(1,min+1):
if n%i==0:
if m%i==0:
a.append(i)
print(a)
Why does the progam show an error saying:
TypeError ‘int’ object is not callable ?
n=27
m=18
a=list()
min= m if m<n else n
for i in range(1,min+1):
if n%i==0:
if m%i==0:
a.append(i)
print(a)
Why does the progam show an error saying:
TypeError ‘int’ object is not callable ?
Hi Samrudh005,
It code be your spacing or indention because when I reformatted your code, it works fine with no errors:
n = 27
m = 18
a = list()
min = m if m < n else n
for i in range(1, min + 1):
if n % i == 0:
if m % i == 0:
a.append(i)
[1, 3, 9]
Let me know if this resolves your issue or if you need further assistance!
Yeah, thank you.There is no problem with the spacing.When I used [ ] instead of list() to create an empty list.The program would not work.
Hi Samrudh005,
The program still works when you use [ ]
instead of list()
to create an empty list:
n = 27
m = 18
a = []
min = m if m < n else n
for i in range(1, min + 1):
if n % i == 0:
if m % i == 0:
a.append(i)
print(a)
[1, 3, 9]
Were you having any other issues with this that I can assist you with?