摘要:
#列表解析+判断语句求偶数# print([i for i in range(1,101) if i %2==0])import randommath_report=[random.randint(0,100) for i in range(20)]chinese_report=[random.ra 阅读全文
posted @ 2022-05-22 23:41
人生信条~~
阅读(41)
评论(0)
推荐(0)
摘要:
#1.统计小写英文字符出现的次数def countchrnum(s): result={} for c in s: if c < 'a' or c > 'z':# 判断字母c < a 或者 c >z continue if c in result: result[c] += 1 else: resu 阅读全文
posted @ 2022-05-22 19:11
人生信条~~
阅读(204)
评论(0)
推荐(0)
摘要:
#字典详解d={'a':'98','b':'97'}a=dict(x=10,y=20) #创建对象b=((('x',90),'y',100))s1='abc's2='123'print(dict(zip(s1,s2)))print(dict.fromkeys(s1,-1))print(a,b)pri 阅读全文
posted @ 2022-05-22 17:19
人生信条~~
阅读(36)
评论(0)
推荐(0)
摘要:
#冒泡排序list1=[3,2,4,1,5,0]#外部def bubblesort(l): for end in range(len(list1)-1): #内部两两交换位置 循环,len(list1)-end-1 for index in range(len(list1)-end-1): if l 阅读全文
posted @ 2022-05-22 15:29
人生信条~~
阅读(24)
评论(0)
推荐(0)

浙公网安备 33010602011771号