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))
    

     

  • 相关阅读:
    系统维护-安全-测试等方面的开源项目
    linux命令学习
    Rancher + k8s + docker 部署资料
    个人java框架 技术分析
    java十年,需要学会的Java开发体系
    IdentityServer4 经典文章
    .net core 资料网站 和 开源项目
    Java 学习资料网站集合
    spring cloud资料汇总
    秦九韶公式 【多项式】
  • 原文地址:https://www.cnblogs.com/piglet00/p/8599737.html
Copyright © 2011-2022 走看看