摘要: import time import turtle as tt # 绘制间隔 def drawGap(): tt.penup() tt.fd(5) # 绘制单段数码管 def drawLine(draw): drawGap() if (draw): tt.pendown() else: tt.pen 阅读全文
posted @ 2020-12-14 19:43 fangxiaolog 阅读(112) 评论(0) 推荐(0)
摘要: def PI(n): pi=0 for k in range(n): pi += 1/pow(16,k)*(4/(8*k+1)-2/(8*k+4)-1/(8*k+5)-1/(8*k+6)) return pi import time scale = 20 print("执行开始".center(sc 阅读全文
posted @ 2020-12-14 19:20 fangxiaolog 阅读(102) 评论(0) 推荐(0)
摘要: (2)请用requests库的get()函数访问如下一个网站20次,打印返回状态,text()内容,计算text()属性和content属性所返回网页内容的长度。(不同学号选做如下网页,必做及格) import requests for i in range (20): print("第",i+1, 阅读全文
posted @ 2020-12-13 17:01 fangxiaolog 阅读(113) 评论(0) 推荐(0)
摘要: 什么是NumPy? NumPy(Numerical Python) 是 Python 语言的一个扩展程序库,支持大量的维度数组与矩阵运算,此外也针对数组运算提供大量的数学函数库。 NumPy 的前身 Numeric 最早是由 Jim Hugunin 与其它协作者共同开发,2005 年,Travis 阅读全文
posted @ 2020-11-23 18:58 fangxiaolog 阅读(100) 评论(0) 推荐(0)
摘要: 即: 一局比赛:在一局比赛中,先得11分的一方为胜方;10平后,先多得2分的一方为胜方。 一场比赛:单打的淘汰赛采用七局四胜制,双打淘汰赛和团体赛采用五局三胜制。 from random import random #打印程序介绍信息 def printIntro(): print("这个程序模拟两 阅读全文
posted @ 2020-11-22 19:53 fangxiaolog 阅读(496) 评论(0) 推荐(0)
摘要: import jieba #添加jieba分词 mydict = ['聂小倩',"宁采臣",'燕赤霞','黑山老妖','辛十四娘'] for item in mydict: jieba.add_word(item) txt = open('聊斋志异.txt',"r", encoding='utf-8 阅读全文
posted @ 2020-11-14 20:21 fangxiaolog 阅读(93) 评论(0) 推荐(0)
摘要: import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.pensize(1) turtle.pencolor("red") turtle.fillcolor("purple") turtle.begin_fill() tur 阅读全文
posted @ 2020-09-15 11:54 fangxiaolog 阅读(1888) 评论(0) 推荐(0)
摘要: import turtle turtle.setup(650,350,200,200) turtle.penup() turtle.pensize(1) turtle.pencolor("red") turtle.fillcolor("white") turtle.fd(100) turtle.se 阅读全文
posted @ 2020-09-15 11:52 fangxiaolog 阅读(1028) 评论(0) 推荐(0)
摘要: import turtle # 设置画布大小 # turtle.screensize(canvwidth=None, canvheight=None, bg=None) turtle.setup(500,500,200,200) # 设置初始位置 turtle.penup() turtle.left 阅读全文
posted @ 2020-09-15 11:49 fangxiaolog 阅读(527) 评论(0) 推荐(0)