This commit is contained in:
Bigsk 2024-09-20 07:28:40 +00:00
commit a20d225b4d

9
240920.py Normal file
View File

@ -0,0 +1,9 @@
is_palindromic = lambda n: n[0:len(n) // 2] == n[-1:len(n) // 2:-1] if len(n) % 2 else n[0:len(n) // 2] == n[-1:len(n) // 2 - 1:-1]
remove_repeat = lambda w: "".join([w[j] for j in range(len(w)) if w[j] not in w[0:j]])
remove_repeat_defind = lambda a, b: [d for d in a if d not in b]
extrace_digit = lambda s: "".join([w for w in s if w.isdigit()])
remove_repeat_nums = lambda n: "".join([str(n[i]) for i in range(len(n)) if n[i] not in n[0:i]])
rank_num = lambda n: {j[0]: j[1] for j in dict(zip(n, [n.count(i) for i in n])).items() if j[1] == list(set([n.count(i) for i in n]))[-1]}
print_num_rank = lambda n: [print(f"{k[0]}字符出现的次数为{k[1]}") for k in sorted([[j[0], j[1]] for j in dict(zip(n, [n.count(i) for i in n])).items()], key=lambda x: x[1], reverse=True)]