- 博客(15)
- 收藏
- 关注
原创 turtle 绘图程序
import turtleturtle.penup()turtle.goto(100,0)turtle.pendown()turtle.begin_fill()turtle.fillcolor('#0000FF')for i in range(3): turtle.forward(150) turtle.left(120)turtle.end_fill()turtle.penup()turtle.goto(-200,-100)turtle.pendown()turtle.be.
2022-02-22 21:17:48 285
原创 turtle图形绘制
import turtlecl=['#000000','#FF0000','#00FF00','#00FFFF','#0000FF']for i in range(4): turtle.begin_fill() turtle.fillcolor(cl[i]) turtle.seth(90*(i+1)) turtle.circle(200,90) turtle.seth(-90+i*90) turtle.circle(200,90) turtle.end_fill()turtle.pen.
2022-02-22 21:16:06 252
原创 生成随机密码
import randomimport oscode_list = []name = "电子 2011"for i in range(2): first_kind = random.randint(65, 90) # 大写字母 random_uppercase = chr(first_kind) #转换为字符串 code_list.append(random_uppercase) #添加到列表中for i in range(3): second_kinds = random.randin.
2022-02-22 21:12:43 127
原创 os.mkdir()函数创文件夹
import jiebaimport osname = "电子 2011"fi = open("天龙八部-网络版.txt", "r", encoding='utf-8')if not os.path.exists(name): os.mkdir(name)txt_path = name +"/"+ "电子 2011.txt"fo = open(txt_path, "w", encoding='utf-8')txt = fi.read()words = jieba.lcut(txt)co.
2022-02-22 21:09:05 307
原创 水仙花数三位数
for i in range(100,1000):a=i//100b=i//10%10c=i%10if a**3+b**3+c**3 ==i:print(i)
2022-02-22 20:53:00 108
原创 已知字符串变量 s,统计其个字符出现的次数并打印出来
s = '红凤凰,粉凤凰,粉红凤凰黄凤凰' L =[] counts = {} for i in s: L.append(i) for word in L: counts[word] = counts.get(word,0)+1 items = list(counts.items()) items.sort(key=lambda x: x[1], reverse=True) print(items)
2022-02-22 20:50:12 2076
空空如也
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人