• Pycharm开发环境设置与熟悉。


    练习基本输入输出:

    print('你好,{}.'.format(name))

    print(sys.argv)

    库的使用方法:

    import ...

    from ... import ...

    条件语句:

        if (abs(pos()))<1:

            break

    循环语句:

    for i in range(5):

    while True:

    函数定义:

    def mygoto(x,y):

    def drawjx(r):

    综合练习:画一面五星红旗,将代码与运行截图发布博客交作业。

    import turtle
    
    def mygoto(x, y):
        turtle.up()
        turtle.goto(x, y)
        turtle.down()
    
    def drawF(x):
        turtle.begin_fill()
        for i in range (5):
            turtle.forward(x)
            turtle.right(144)
        turtle.end_fill()
    
    turtle.setup=(600, 400, 0, 0)
    turtle.color("yellow")
    turtle.bgcolor('red')
    turtle.fillcolor("yellow")
    
    mygoto(-270, 120)
    drawF(120)
    
    for i in range(4):
        x=1
        if i in [0, 3]:
            x=0
        mygoto(-120+x*30,150-i*40)
        turtle.left(15-i*15)
        drawF(30)
    
    mygoto(0, 0)
    turtle.hideturtle()
    turtle.done()

    字符串练习:

    http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html

    取得校园新闻的编号

    str = "http://news.gzcc.cn/html/2017/xiaoyuanxinwen_1027/8443.html"
    num = str.rstrip(".html").split("_")[1]
    print(num)

    https://docs.python.org/3/library/turtle.html

    产生python文档的网址

    str1 = "https://docs.python.org/3.6/library/"
    str2 = ".html"
    str =str1+"turtle"+str2
    print(str)

    http://news.gzcc.cn/html/xiaoyuanxinwen/4.html

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

    for i in range(2,10):
      str = "http://news.gzcc.cn/html/xiaoyuanxinwen/{}.html".format(i)
      print(str)

    练习字符串内建函数:strip,lstrip,rstrip,split,count,replace

    用函数得到校园新闻编号

    用函数统计一歌词(文章、小说)中单词出现的次数,替换标点符号为空格,用空格进行分词。

    str = '''
    I'm hurting, baby, I'm broken down
    I need your loving, loving, I need it now
    When I'm without you
    I'm something weak
    You got me begging
    Begging, I'm on my knees
    I don't wanna be needing your love
    I just wanna be deep in your love
    And it's killing me when you're away
    Ooh, baby,
    'Cause I really don't care where you are
    I just wanna be there where you are
    And I gotta get one little taste
    Your sugar
    Yes, please
    Won't you come and put it down on me
    I'm right here, 'cause I need
    Little love and little sympathy
    Yeah you show me good loving
    Make it alright
    Need a little sweetness in my life
    Your sugar
    Yes, please
    Won't you come and put it down on me
    My broken pieces
    You pick them up
    Don't leave me hanging, hanging
    Come give me some
    When I'm without ya
    I'm so insecure
    You are the one thing
    The one thing, I'm living for
    I don't wanna be needing your love
    I just wanna be deep in your love
    And it's killing me when you're away
    Ooh, baby,
    'Cause I really don't care where you are
    I just wanna be there where you are
    And I gotta get one little taste
    Your sugar
    Yes, please
    Won't you come and put it down on me
    I'm right here, 'cause I need
    Little love and little sympathy
    Yeah you show me good loving
    Make it alright
    Need a little sweetness in my life
    Your Sugar! (Your sugar!)
    Yes, please (Yes, please)
    Won't you come and put it down on me
    Yeah
    I want that red velvet
    I want that sugar sweet
    Don't let nobody touch it
    Unless that somebody's me
    I gotta be a man
    There ain't no other way
    'Cause girl you're hotter than southern California Bay
    I don't wanna play no games
    I don't gotta be afraid
    Don't give all that shy shit
    No make up on, that's my
    Sugar
    Yes, please
    Won't you come and put it down on me (down on me!)
    Oh, right here (right here),
    'Cause I need (I need)
    Little love and little sympathy
    Yeah you show me good loving
    Make it alright
    Need a little sweetness in my life
    Your sugar! (Sugar!)
    Yes, please (Yes, please)
    Won't you come and put it down on me
    Your sugar
    Yes, please
    Won't you come and put it down on me
    I'm right here, 'cause I need
    Little love and little sympathy
    Yeah you show me good loving
    Make it alright
    Need a little sweetness in my life
    Your sugar
    Yes, please
    Won't you come and put it down on me
    (Down on me, down on me)'''
    print(str.count("sugar"))
    print(str.replace(","," "))

  • 相关阅读:
    友盟—安卓巴士【Android开发原创教程大赛】
    iOS开发视频教程下载/iphone开发视频教程下载
    发一个Android开发的外包项目。欢迎外包团队来骚扰
    安卓巴士总结了近百个Android优秀开源项目,覆盖Android开发的每个领域
    安卓巴士精选Android开发教程
    做了一个系列的Android开发教程列表
    深刻理解C#的传值调用和传引用调用
    《CLR Via C# 第3版》笔记之(四) 类中字段的默认赋值
    《CLR Via C# 第3版》笔记之(七) const和readonly
    《CLR Via C# 第3版》笔记之(十二) 事件
  • 原文地址:https://www.cnblogs.com/BOXczx/p/8619333.html
Copyright © 2020-2023  润新知