实验六

from turtle import *

def square(size=50, rbg='blue'):
    pencolor(rbg)
    for i in range(4):
        fd(size)
        left(90)


setup(800,600)
speed(0)
for i in range(10):
        square()
        left(36)

hideturtle()
done()

实验六

from turtle import *

setup(800,600)
pencolor('yellow')
speed(0)

def yuan():
    for i in range(2):
        circle(80,90)
        left(90)

for j in range(10):
    yuan()
    left(36)

hideturtle()
done()

实验六

from turtle import *
speed(0)
setup(800,600)
pencolor('red')

angle=0
size=2

for i in range(10):
    for j in range(5):
        fd(size)
        angle=angle+72
        seth(angle)
        size=size+5
hideturtle()
done()

实验六

from turtle import *
from random import random
def square():
    for i in range(2):
        fd(10)
        left(90)
        fd(20)
        left(90)
speed(0)
setup(800,600)
penup()
left(180)
fd(100)
left(180)
pendown()
for j in range(20):
    rgb=tuple(random() for k in range(3))
    color(rgb)
    begin_fill()
    square()
    end_fill()
    square()
    fd(10)
done()

实验六

 

上一篇:实验六


下一篇:linux内核分析 第四周