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

    from turtle import *
    turtle.setup(600, 400, 10, 10)
    turtle.bgcolor('red')
    turtle.hideturtle()
    turtle.speed(10)
    turtle.pencolor('yellow')
      
    def draw(chang):
        turtle.fillcolor('yellow')
        turtle.begin_fill()
        for i in range(5):
            turtle.forward(chang)
            turtle.right(144)
        turtle.end_fill()
      
    def gotopen(x,y):
        turtle.penup()
        turtle.goto(x,y)
        turtle.pendown()
      
    gotopen(-250,110)
    draw(110)
      
    gotopen(-100,160)
    turtle.right(-15)
    draw(40)
      
    gotopen(-60,120)
    turtle.right(0)
    draw(40)
      
    gotopen(-60,80)
    turtle.right(15)
    draw(40)
      
    gotopen(-100,40)
    turtle.right(30)
    draw(40)
      
    turtle.done

     

    取得校园新闻的编号:

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

    产生python文档的网址:

    def strCat(html,x):
        b=html[:-11]
        c=html[-5:]
        d=b+x+c
        print(d)
    
        
    strCat("https://docs.python.org/3/library/turtle.html","intro")

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

    a = "http://news.gzcc.cn/html/xiaoyuanxinwen/4.html"
    b=a[:-6]
    c=a[-5:]
    for i in range(5):
        d=""
        d=b+str(i)+c
        print(d)
  • 相关阅读:
    第三周学习进度
    计算最低价格
    第二阶段冲刺5
    第二阶段冲刺4
    第十三周进度条
    第二阶段冲刺3
    寻找小水王
    第二阶段冲刺2
    第二阶段冲刺1
    构建之法阅读笔记
  • 原文地址:https://www.cnblogs.com/wban48/p/8604314.html
Copyright © 2011-2022 走看看