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

    import turtle
    
    turtle.setup(600, 400, 0, 0)
    turtle.color('yellow')
    turtle.bgcolor('red')
    turtle.fillcolor('yellow')
    
    turtle.speed(10)
    def mygoto(x,y):
        turtle.up()
        turtle.goto(x,y)
        turtle.down()
    
    def write(x):
        turtle.begin_fill()
        for i in range(5):
            turtle.forward(x)
            turtle.right(144)
        turtle.end_fill()
    
    mygoto(-220,75)
    write(100)
    
    for n in range(4):
        x=1
        if n in [0,3]:
            x=0
        mygoto(-100+x*50,150-n*60)
        turtle.right(15-n*15)
        write(30)
    
    turtle.done()

    取得校园新闻的编号:

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

    产生python文档的网址:

    str = "https://docs.python.org/3/library/turtle.html";
    print(str.replace("turtle", "test"))

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

    for i in range[2,299]:
        print("http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html".format(i))
    
  • 相关阅读:
    [loj3031]聚会
    [loj3146]路灯
    [loj2049]网络
    [luogu7599]雨林跳跃
    [loj3069]整点计数
    [loj3301]魔法商店
    [loj3333]混合物
    [cf1515I]Phoenix and Diamonds
    [cf1515H]Phoenix and Bits
    [atARC116F]Deque Game
  • 原文地址:https://www.cnblogs.com/w092/p/8600421.html
Copyright © 2011-2022 走看看