本文主要是介绍询问画表格,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
import random
import turtledef xian(a, b):turtle.goto(0, 0)turtle.goto(a, 0)turtle.goto(b, 0)turtle.goto(0, 0)def draw():draw_number = turtle.textinput("输入重复次数", "重复次数?")draw_number = int(draw_number)draw_number2 = turtle.textinput("输入宽度", "宽度?")draw_number2 = int(draw_number2)a1 = draw_number * 100 / 2a1 = int(a1)a2 = draw_number * 100 / 2b2 = draw_number * 100 / 2 - a2 - a2turtle.screensize(1600, a1)bc1 = draw_number2 * 100 / 2bc2 = draw_number2 * 100 / 2 - bc1 - bc1random.randint(bc2, bc1)random.randint(b2, a2)draw_number = draw_number + 1b = draw_numberxian(bc1, bc2)turtle.hideturtle()turtle.speed(0)turtle.penup()turtle.goto(-125, a1)turtle.pendown()turtle.write('K最临近算法表格', font=("Arial", 15, "normal"))turtle.penup()c = 1a3 = a1 + 100for u in range(draw_number):yi = a3 - 100a3 = yiif c >= 1:if c < draw_number:turtle.penup()turtle.goto(bc2, yi)turtle.backward(30)b = b - 1turtle.write(b, font=("Arial", 15, "normal"))turtle.goto(bc2, yi)turtle.pendown()for i in range(draw_number2):turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)c = c + 1else:turtle.penup()turtle.goto(bc2, yi)turtle.backward(30)b = b - 1turtle.write(b, font=("Arial", 15, "normal"))turtle.goto(bc2, yi)for o in range(draw_number2):turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)c = c + 1else:b = b - 1turtle.penup()turtle.goto(bc2, yi)turtle.pendown()for _ in range(draw_number2):turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)turtle.right(90)turtle.forward(100)c = c + 1turtle.penup()turtle.right(90)turtle.forward(bc1 / 10)turtle.left(90)turtle.backward(bc1)turtle.backward(bc1)b = 0for o in range(draw_number2 + 1):turtle.penup()turtle.write(b, font=("Arial", 15, "normal"))b = b + 1turtle.forward(100)draw_number3 = turtle.textinput("输入重复次数", "重复次数?")draw_number3 = int(draw_number3)turtle.speed(0)turtle.showturtle()for e in range(draw_number3 * 10):sd = draw_number3 * 50 - draw_number3 * 100sd = int(sd)ad = draw_number3 * 100 / 2ad = int(ad)ran_dom = random.randint(sd, ad)ram_dom = random.randint(bc2, bc1)m = ram_domn = ran_domprint(m, n)turtle.goto(m, n)turtle.clone()turtle.hideturtle()draw()
turtle.done()
这篇关于询问画表格的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!