Python基础综合练习——画五星红旗

import turtle

def mygoto(x, y):
    turtle.up()
    turtle.goto(x, y)
    turtle.down()

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

turtle.setup(600, 400, 0, 0)
turtle.bgcolor('red')
turtle.color('yellow')
turtle.fillcolor('yellow')

mygoto(-260, 120)
drawwuxing(100)

for i in range(4):
    x=1
    if i in [0, 3]:
        x = 0
    mygoto(-130+x*40, 150-i*45)
    turtle.left(15-i*15)
    drawwuxing(30)

turtle.hideturtle()
turtle.done()

  

 校园新闻

import turtle
# for i in range(2, 10):
#     addr1 = 'http://news.gzcc.cn/html/xiaoyuanxinwen/'
#     addr2 = '.html'
#     print(addr1 + str(i) + addr2)

for i in range(2, 10):
    addr = 'http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html'.format(i)
    print(addr)

  

 

posted @ 2018-03-20 16:18  HISAM  阅读(537)  评论(0编辑  收藏  举报