
python
徒手☆摘星
xkq
展开
-
python实现switch语句功能
python实现switch语句功能原创 2022-12-05 15:39:20 · 1370 阅读 · 1 评论 -
用于统计字符串中的每个字母的出现次数,按照{'a':3}的个数输出
s='Avcvvvavacbvs's=s.lower();l=list(s)l1=[]for id,x in enumerate(l): c=l.count(x) l1.append((x,c))q=dict(l1)print(q)原创 2019-04-11 11:17:20 · 2009 阅读 · 0 评论 -
python,删除列表中的所有素数
a = [3, 4, 7, 4, 3, 5, 6, 9]b=[]for s in a: for i in range(2, s): if(s % i==0): break; if(i==s-1): b.append(s)for ss in b: while s...原创 2019-03-28 18:26:46 · 24459 阅读 · 4 评论