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

    from turtle import *
    
    
    def mygoto(x, y):
        up()
        goto(x, y)
        down()
    
    
    def draw(r):
        begin_fill()
        for i in range(5):
            forward(r)
            right(144)
        end_fill()
    
    
    setup(700, 500)
    bgcolor('red')
    color('yellow')
    speed(6)
    fillcolor('yellow')
    hideturtle()
    
    mygoto(-300, 150)
    draw(100)
    mygoto(-190, 220)
    draw(45)
    mygoto(-140, 150)
    draw(45)
    mygoto(-140, 90)
    draw(45)
    mygoto(-190, 40)
    draw(45)
    done()

    字符串练习:

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

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

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

    练习字符串内建函数:

    >>> addr='    http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html'
    >>> addr.strip
    <built-in method strip of str object at 0x007952E0>
    >>> print(addr)
        http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html
  • 相关阅读:
    day09
    day08
    day05
    day04
    day03
    day02
    LogCat查看Android运行日志
    ADT+SDK,Android开发环境搭建问题
    第二次冲刺周期第十天
    第二次冲刺周期第九天
  • 原文地址:https://www.cnblogs.com/126lc/p/8599781.html
Copyright © 2011-2022 走看看