03 2020 档案
摘要:一、用动画实现汉诺塔问题: import turtle class Stack: def __init__(self): self.items = [] def isEmpty(self): return len(self.items) == 0 def push(self, item): self
阅读全文
摘要:圆周率的计算 计算公式:pi / 4=1 - 1/3 + 1/5 - 1/7 + 1/9 ...... 梅钦公式:pi /4 = 4arctan1/5 - arctan1/239 n=圆周长/直径 n=圆面积/半径平方 import math import time scale=10 print("
阅读全文
摘要:import turtle as t t.pensize(3) t.pencolor("blue") t.penup() t.fd(-250) t.seth(0) t.pendown() t.fillcolor("yellow") t.begin_fill() n=10 for i in range
阅读全文
摘要:import turtle n = 60 # 每行间隔,小格子边长 x = -300 # x初始值 y = -300 # x初始值 def main(): turtle.speed(11) turtle.pensize(2) turtle.penup() # 先画8*8的正方形,并按要求涂黑 for
阅读全文
摘要:from turtle import * pensize(3) penup() pencolor("black") reset() speed(10) pendown() circle(100,180) circle(200,180) circle(100,-180) fillcolor('blac
阅读全文
摘要:import turtle as t t.setup(600,600,50,50) t.pensize(3) t.pencolor("red") t.penup() t.pendown() t.circle(45) t.penup() t.fd(100) t.seth(0) t.pendown()
阅读全文
摘要:import turtle as t t.pensize(3) t.setup(600,600,50,50) t.pencolor("yellow") t.penup() t.pendown() t.circle(80) t.right(90) t.penup() t.fd(20) t.seth(0
阅读全文
摘要:import turtle as t t.setup(600,600,None,None) t.pensize(5) t.penup() t.pendown() t.pencolor("red") t.circle(80) t.penup() t.pendown() t.pencolor("gree
阅读全文
摘要:import turtle turtle.pensize(5) turtle.pencolor("yellow") turtle.fillcolor("red") turtle.begin_fill() for i in range(0,5): turtle.forward(100) turtle.
阅读全文
摘要:1.Python语言是通用、脚本、开源、跨平台、多模型语言。 而Python绘图:turtle库的使用 —turtle库是turtle绘图体系的python实现 —turtle绘图体系:1969诞生,主要用于程序设计入门 —turtle库是pyrhon语言的标准库之一,是入门级的图形绘制函数库 2.
阅读全文
摘要:import turtle n = eval(input("请输入五角星的长度")) turtle.begin_fill() #开始填充颜色 i = 0 while i < 5: turtle.forward(n) turtle.right(180-36) i += 1 turtle.color("
阅读全文
摘要:from turtle import * color("black","red") begin_fill() pu() fd(-200) pd() seth(30) fd(300) seth(-90) fd(300) seth(150) fd(300) end_fill() pu() seth(90
阅读全文
摘要:import turtle as t t.setup(600, 600, None,None) t.pu() t.fd(-120) t.pensize(5) t.width(5) t.pencolor("darkgreen") t.pd() t.fd(250) t.seth(120) t.penco
阅读全文
摘要:1.使用turtle库绘制红色五角星图形 import turtle n = eval(input("请输入五角星的长度")) turtle.begin_fill() #开始填充颜色 i = 0 while i < 5: turtle.forward(n) turtle.right(180-36)
阅读全文

浙公网安备 33010602011771号