1.用循环画五角星

from turtle import *
color("red")
fillcolor("red")
begin_fill()
for i in range(5):
    forward(150)
    right(144)
end_fill()

2. 用循环画同心圆

from turtle import *
color("red")
for i in range(0,5):
    goto(0,-20*i)
    down()
    circle(20*i)
    up()

3.用while循环画太阳花

import turtle 
turtle.color("black")
turtle.fillcolor("yellow")
turtle.begin_fill()
while True:
    turtle.forward(250)
    turtle.right(170)
    if abs(turtle.pos())<1:
        break
turtle.end_fill()

4.用函数定义画五个五角星

import turtle
turtle.color("yellow")
turtle.fillcolor("yellow")
turtle.bgcolor("red")
def lly_goto(x,y):
    turtle.up()
    turtle.goto(x,y)
    turtle.down()

def mylly(r):
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(r)
        turtle.right(144)
    turtle.end_fill()

lly_goto(-280,200)
mylly(100)

lly_goto(-150,100)
mylly(45)

lly_goto(-100,150)
mylly(45)

lly_goto(-100,210)
mylly(45)

lly_goto(-150,250)
mylly(45)

5.用函数定义画钻石花瓣的太阳花

import turtle
turtle.color("green")
while True:
    turtle.forward(150)
    turtle.right(60)
    turtle.forward(150)
    turtle.right(120)
    turtle.forward(150)
    turtle.right(60)
    turtle.forward(149)
    turtle.right(85)
    if abs(turtle.pos())<1:
        break
turtle.forward(300)

6.输入学号,识别年级、专业、序号

t='''201406114306 '''
for i in range(len(t)):
    print(i,t[i])
    
print("年级是:"+t[:4]+"")
print("专业是:"+"网络工程1班")
print("学号是:"+t[-3:])
      

7.输入1-7的数字,输出对应的“星期几”

 

d = input("请输入一个数字(1-7):")

if d == '1':
    print("星期一")
elif d == '2':
    print("星期二")
elif d == '3':
    print("星期三")    
elif d == '4':
    print("星期四")          
elif d == '5':
    print("星期五")
elif d == '6':
    print("星期六")       
elif d == '7':
    print("星期日")