列表 字符串 练习题
奇数索引位元素构成新列表
def func(lst): return lst[1::2] lst = [1, 2, 3, 4, 5, 6, 7, 8] print(func(lst))
li = ['taibal', 'alexC', 'ABC', 'egon', 'Ritian', 'Wusir', ' aqc'] lst = [] for el in li: if el.strip().endswith("c") and el.strip().upper().startswith("A"): lst.append(el) print(lst)

浙公网安备 33010602011771号