Write a python function to check if the given structure is a instance of list or dictionary


Topic: Write a python function to check if the given structure is a instance of list or dictionary

Solution

def check_insst(obj):
    if isinstance(obj, list):
        return "list"
    elif isinstance(obj, dict):
        return "dict"
    else:
        return "unknown"
   
check_insst({})



List all Python Programs