Write a python function to check if the given structure is a instance of tuple or string


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

Solution

def check_inst_tup_str(obj):
    if isinstance(obj, set):
        return "set"
    elif isinstance(obj, tuple):
        return "tuple"
    else:
        return "unknown"
check_inst_tup_str({1})



List all Python Programs