Showing error in 'in' operator topic


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

Replace this line with your code. 
for dict in my_dict:
    print dict, my_dict[dict]


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.


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