I have started learning Python. I have created a class which has a function and in that function i have a dictionary . No i am checking whether a key exists in the dictionary or not , after checking i am returning a value from the function .
Now i cam trying to access the function but when when i am doing so i am getting an error "TypeError: first_func() takes 0 positional arguments but 1 was given"
Below is the code which i am using :
class myFirst:
def first_func():
flag=0
phonebook = {
"A" : 938477566,
"B" : 938377264,
"C" : 947662781
}
# testing code
if "A" in phonebook:
flag=1
if "D" not in phonebook:
flag = 0
return flag
myclassObj = myFirst()
status = myclassObj.first_func()
if status > 1:
print ("Pass")
else:
print ("fail")