In [1]:
def print_len_lbyl_list(x):
    if isinstance(x, list):
        print(len(x))
    else:
        print('x is not list')

In [2]:
print_len_lbyl_list([0, 1, 2])


3

In [3]:
print_len_lbyl_list(100)


x is not list

In [4]:
print_len_lbyl_list((0, 1, 2))


x is not list

In [5]:
print_len_lbyl_list('abc')


x is not list

In [6]:
def print_len_lbyl_list_tuple(x):
    if isinstance(x, (list, tuple)):
        print(len(x))
    else:
        print('x is not list or tuple')

In [7]:
print_len_lbyl_list_tuple([0, 1, 2])


3

In [8]:
print_len_lbyl_list_tuple(100)


x is not list or tuple

In [9]:
print_len_lbyl_list_tuple((0, 1, 2))


3

In [10]:
print_len_lbyl_list_tuple('abc')


x is not list or tuple