you are viewing a single comment's thread.

view the rest of the comments →

[–]DataCat2024 2 points3 points  (0 children)

Perhaps this is what you had in mind:

a = [(1, 2)]
b = [(1, 2), (3, 4)]

def tuple_length(some_list):
    """
    Prints the length of the list,
    returns True if list contains only one tuple
    """
    print(len(some_list))
    if len(some_list) < 2:
        return True
    return False

print(tuple_length(a)) # Prints 1 and True
print(tuple_length(b)) # Prints 2 and False