Following is my code:
class MyClass:
"This is my second class"
a=["1224","2334","3445"]
b=int(input("Enter the PIN number"))
entries={1224:"X",2334:"Y",3445:"Z"}
def check(self,int):
che=False
for c in range(0,3):
if (m.b==int(m.a[c])):
che=True
break
else:
che=False
print(che)
def func(int):
print('Hello',entries[b])
m=MyClass()
m.check(m.b)
Whenever I try to convert String to integer from inside a method I get the TypeError:
Enter the PIN number1224
Traceback (most recent call last):
File "MyClass.py", line 18, in <module>
m.check(m.b)
File "MyClass.py", line 9, in check
if (m.b==int(m.a[c])):
TypeError: 'int' object is not callable
self.arather thanm.bandm.aas this will allow any name for the class