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

     

  • 相关阅读:
    Spring的AOP与代理
    JAVA 反射机制
    JDK动态代理与Cglib库
    HDFS的运行原理(转)
    Spring中IoC的入门实例
    spring
    Spring中IOC和AOP的详细解释
    自己动手写ORM
    Mongodb 安装
    mongodb集群配置分片集群
  • 原文地址:https://www.cnblogs.com/piglet00/p/8599737.html
Copyright © 2011-2022 走看看