![](https://img-blog.csdnimg.cn/20201014180756754.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
python
文章平均质量分 81
个人学习笔记
是陈陈鸭
这个作者很懒,什么都没留下…
展开
-
基础练习
1、统计’gvbsduifgjkdbgfjgjksgbfjsgu1234’中每一个字符出现的次数。str3='gvbsduifgjkdbgfjgjksgbfjsgu1234'count = {}for item in str3: if item not in count: count[item] = 1 else: count[item] += 1for k,v in count.items(): print("字符:", k, "\t","出原创 2021-01-09 23:25:50 · 221 阅读 · 0 评论 -
类和函数练习
1、用map来处理字符串列表,把列表中所有人都变成good,比方alex_good。def exchange(list1): return list1+'good'if __name__=='__main__': print(list(map(exchange,['alex','ann','Bob','lily'])))返回结果:[‘alexgood’, ‘anngood’, ‘Bobgood’, ‘lilygood’]2、用filter函数处理数字列表,将列表中所有的偶数筛选出原创 2021-01-09 21:42:01 · 328 阅读 · 1 评论