zoukankan      html  css  js  c++  java
  • Python基础综合练习

    import  turtle
    
    turtle.screensize(bg='red')
    turtle.color('yellow')
    
    def mygoto(x,y):
        turtle.up()
        turtle.goto(x,y)
        turtle.down()
    
    mygoto(-250, 125)
    
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(125)
        turtle.right(144)
    turtle.end_fill()
    
    mygoto(-105, 165)
    turtle.left(40)
    
    turtle.begin_fill()
    for i in range(5):
        turtle.forward(35)
        turtle.right(144)
    turtle.end_fill()
    
    mygoto(-30, 135)
    turtle.right(10)
    
    turtle.begin_fill()
    for i in range(5):
        turtle.right(144)
        turtle.forward(35)
    turtle.end_fill()
    
    mygoto(-40, 75)
    turtle.left(40)
    
    turtle.begin_fill()
    for i in range(5):
        turtle.right(144)
        turtle.forward(35)
    turtle.end_fill()
    
    mygoto(-75, 20)
    turtle.right(20)
    
    turtle.begin_fill()
    for i in range(5):
        turtle.right(144)
        turtle.forward(35)
    turtle.end_fill()
    
    turtle.done()

    运行结果截图:

    字符串练习:

    http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html

    取得校园新闻的编号

    str = 'http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html'
    print(str[-14:-5])

    https://docs.python.org/3/library/turtle.html

    产生python文档的网址

    addr1 = 'https://docs.python.org/3.6/library/'
    addr2 = '.html'
    addr = addr1 + 'turtle' + addr2
    print(addr)

    http://news.gzcc.cn/html/xiaoyuanxinwen/4.html

    产生校园新闻的一系列新闻页网址

    for i in range(2,229):
        print('http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html'.format(i))
  • 相关阅读:
    PS封装ES流
    win7无法删除文件夹,提示“找不到该项目”
    声明
    ZR#1005
    ZR#1004
    ZR#1009
    ZR#1008
    ZR#1015
    ZR#1012
    ZR#985
  • 原文地址:https://www.cnblogs.com/131li/p/8600067.html
Copyright © 2011-2022 走看看