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


    from turtle import  *
    
    
    def mygoto(x,y):
       up()
       goto(x,y)
       down()
    
    def mygoto(x,y):
       up()
       goto(x,y)
       down()
    
    def mystar(x):
        begin_fill()
        for  i in range(5):
            forward(x)
            right(144)
        end_fill()
    
    setup(700,500,0,0)
    bgcolor("red")
    fillcolor("yellow")
    color('yellow')
    hideturtle()
    # 隐藏画笔
    
    mygoto(-300,150)
    mystar(100)
    mygoto(-190,220)
    mystar(45)
    mygoto(-140,150)
    mystar(45)
    mygoto(-140,90)
    mystar(45)
    mygoto(-190,40)
    mystar(45)
    
    done()
    

    for i in range(2, 229):
        print(i)
        url = "http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html"
        for i in range(1,230):
            if i == 1:
                print(url.format('index'))
            else:
                print(url.format(i))
    

     

    a = '     hello!python!哈!哈!哈   '
    print(a.strip(), '\n ---------------------')
    print(a.lstrip(), '\n---------------------')
    print(a.rstrip(), '\n---------------------')
    print(a.count('!'), '\n---------------------')
    print(a.split('!'))
    

    str = '''Hey Jude, don't make it bad.
    Take a sad song and make it better.
    Remember to let her into your heart,
    Then you can start to make it better.
    Hey Jude, don't be afraid.
    You were made to go out and get her.
    The minute you let her under your skin,
    Then you begin to make it better.
    And anytime you feel the pain, hey Jude, refrain,
    Don't carry the world upon your shoulders.
    For well you know that it's a fool who plays it cool
    By making his world a little colder.
    Hey Jude, don't let me down.
    You have found her, now go and get her.
    Remember to let her into your heart,
    Then you can start to make it better.
    So let it out and let it in, hey Jude, begin,
    You're waiting for someone to perform with.
    And don't you know that it's just you, hey Jude, you'll do,
    The movement you need is on your shoulder.
    Hey Jude, don't make it bad.
    Take a sad song and make it better.
    Remember to let her under your skin,
    Then you'll begin to make it
    Better better better better better better, oh.
    na na na, na na na na, na na na, hey Jude
    na na na, na na na na, na na na, hey Jude..'''
    sub = 'na'
    print(str.count(sub))
    

     

  • 相关阅读:
    反射遍历实体类
    Socket通讯实例-基本Socket
    c#向数据库插入较大数据(SqlBulkCopy)
    C#中(int)、int.Parse()、int.TryParse()和Convert.ToInt32()的区别
    jquery实现限制textarea输入字数
    jquery回车执行某个事件
    asp.net自定义404页面
    iis上json解析失败404
    echart 扩展地图不显示问题
    bootstarp 样式细节(tooltip布局)
  • 原文地址:https://www.cnblogs.com/piglet00/p/8599737.html
Copyright © 2011-2022 走看看