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

     

  • 相关阅读:
    js append()和appendChild()和insertBefore()的区别
    webpack打包工具简单案例
    Vue $ref 的用法
    Vue学习笔记-作用域插槽
    Vue学习笔记-插槽基本使用
    Vue学习笔记-父子通信案例
    Echarts案例-折线图
    Echarts案例-柱状图
    软件构造实验三-递归下降分析分析法
    软件构造实验二-拷贝一个c文件 将其中的关键字int替换成float
  • 原文地址:https://www.cnblogs.com/piglet00/p/8599737.html
Copyright © 2011-2022 走看看