Showing error in 'in' operator topic


#1



showing isinstance() arg2 must be a class, type or tuple of classes and types


Replace this line with your code. 
my_dict={"hi":32,"go":36,"ten":11}
for dict in my_dict:
    print dict, my_dict[dict]


#2

Hi, @ak1997 ,

You used dict as the name of a variable in your loop. However, dict is also the name for the dictionary type and the name of a built in function in Python. That is the cause of the problem. Use a different name for the variable. It is best not to use the name of a type or built in function as the name of a variable. Examples of types and built in functions are dict, list, int, and float.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.