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))
  • 相关阅读:
    0593. Valid Square (M)
    0832. Flipping an Image (E)
    1026. Maximum Difference Between Node and Ancestor (M)
    0563. Binary Tree Tilt (E)
    0445. Add Two Numbers II (M)
    1283. Find the Smallest Divisor Given a Threshold (M)
    C Primer Plus note9
    C Primer Plus note8
    C Primer Plus note7
    C Primer Plus note6
  • 原文地址:https://www.cnblogs.com/129lai/p/8599644.html
Copyright © 2011-2022 走看看