追追比

导航

2020年12月14日 #

叠加等边三角形

摘要: import turtle def drawTriangle(num,len,flag):#flag用来调整画三角形的方向 flag*=-1 len/=2 if(num==1): if(flag==1): turtle.left(60) turtle.fd(len) turtle.right(120 阅读全文

posted @ 2020-12-14 18:58 追追比 阅读(95) 评论(0) 推荐(0) 编辑

爬虫作业

摘要: import requests for i in range (20): print("第",i+1,"次访问") r=requests.get("https://www.google.cn/") r.encoding='utf-8' print("返回状态:",r.status_code) pri 阅读全文

posted @ 2020-12-14 16:24 追追比 阅读(45) 评论(0) 推荐(0) 编辑

2020年11月23日 #

读书报告

摘要: import numpy as np ls1 = [10, 42, 0, -17, 30] nd1 =np.array(ls1) print(nd1) print(type(nd1)) import scipy import numpy as np from scipy import linalg 阅读全文

posted @ 2020-11-23 08:48 追追比 阅读(42) 评论(0) 推荐(0) 编辑

比赛模拟-排球

摘要: from random import random def printInfo(): # 打印程序介绍信息 print('这个程序模拟两个选手A和B的某种竞技比赛') print('程序运行需要A和B的能力值(以0到1之间的小数表示)') def getInputs(): # 获得程序运行参数 a 阅读全文

posted @ 2020-11-23 08:46 追追比 阅读(25) 评论(0) 推荐(0) 编辑

2020年11月1日 #

面向对象和面向过程

摘要: #第1种 print("小明,10岁,男,上山去砍柴") print("小明,10岁,男,开车去东北") print("小明,10岁,男,最爱打游戏") print("\n") print("老李,90岁,男,上山去砍柴") print("老李,90岁,男,开车去东北") print("老李,90岁 阅读全文

posted @ 2020-11-01 10:07 追追比 阅读(52) 评论(0) 推荐(0) 编辑

2020年10月19日 #

时间差之天数计算

摘要: def time_long(time1, time2, type="day"): """ 计算时间差 :param time1: 较小的时间(datetime类型) :param time2: 较大的时间(datetime类型) :param type: 返回结果的时间类型(暂时就是返回相差天数) 阅读全文

posted @ 2020-10-19 19:27 追追比 阅读(204) 评论(0) 推荐(0) 编辑

用Python计算圆周率π

摘要: from random import random from time import perf_counter DARTS = 1000 * 1000 hits = 0.0 start = perf_counter() for i in range(1,DARTS+1): x,y = random( 阅读全文

posted @ 2020-10-19 19:26 追追比 阅读(157) 评论(0) 推荐(0) 编辑

六角形的绘制

摘要: from turtle import* #第一个三角形 seth(90) fd(300) seth(-30) fd(300) seth(-150) fd(300) #第二个三角形 seth(0) penup() fd((300*1.732/2)*2/3) #运行到三角形左下的第一条边的三分之二处 p 阅读全文

posted @ 2020-10-19 19:10 追追比 阅读(390) 评论(0) 推荐(0) 编辑

2020年10月18日 #

7段数码管绘制

摘要: import turtle, datetime def drawGap(): turtle.up() turtle.fd(5) def drawLine(draw): drawGap() if(draw): turtle.down() else: turtle.up() turtle.fd(40) 阅读全文

posted @ 2020-10-18 23:15 追追比 阅读(68) 评论(0) 推荐(0) 编辑

2020年9月21日 #

龟兔赛跑

摘要: T=input() T=int(T) t=0 rabit=0 turtle=0 stop=False timer=0 if(T>0): while(t<T): if(t%10==0): if(rabit>turtle): if(timer==30): timer=0 stop=False stop= 阅读全文

posted @ 2020-09-21 19:15 追追比 阅读(121) 评论(0) 推荐(0) 编辑