1 2 3 4 5
def count_first_elements(test_tup): for count, ele in enumerate(test_tup): if isinstance(ele, tuple): break return (count)