大宮盆栽デイズ - Omiya Bonsai Days -

冗談めかす埼玉のファインマン

@CheckiO@Easy Unpack

def easy_unpack(elements: tuple) -> tuple:
    """
        returns a tuple with 3 elements - first, third and second to the last
    """
    # your code here
    elem_first = elements[0]
    elem_third = elements[2]
    elem_last = elements[-2]
    t = elem_first, elem_third, elem_last
    return tuple(t)


if __name__ == '__main__':
    print('Examples:')
    print(easy_unpack((1, 2, 3, 4, 5, 6, 7, 9)))
    
    #These "asserts" using only for self-checking and not necessary for auto-testing
    assert easy_unpack((1, 2, 3, 4, 5, 6, 7, 9)) == (1, 3, 7)
    assert easy_unpack((1, 1, 1, 1)) == (1, 1, 1)
    assert easy_unpack((6, 3, 7)) == (6, 7, 3)
    print('Done! Go Check!')