函数式回文串

def all_equal(lst):
    print(lst[:])
    # [1, 2, 3, 4, 5, 6]
    # [1, 1, 1, 1]
    print(lst[::-1])
    # [6, 5, 4, 3, 2, 1]
    # [1, 1, 1, 1]
    print(lst[1:] == lst[:-1])

all_equal([1, 2, 3, 4, 5, 6])
# False
all_equal([1, 1, 1, 1])
# True

 


2020-05-03

原文地址:https://www.cnblogs.com/hany-postq473111315/p/12821617.html