美文网首页Python三期爬虫作业
【Python爬虫】-第二周作业

【Python爬虫】-第二周作业

作者: 游离的栖息地 | 来源:发表于2017-08-04 08:13 被阅读11次

    people = 20
    cats = 30
    dogs = 15
    print(dogs)
    if people < cats:

    如果20<15 执行下面代码

    print( "Too many cats! The world is doomed!")
    

    if people > cats:

    如果20>15 执行这句代码

    print( "Not many cats! The world is saved!")
    

    if people < dogs:

    如果20<15 执行这句代码

    print( "The world is drooled on!")
    

    if people > dogs:

    如果20>15 执行这句代码

    print(   "The world is dry!")
    

    让dogs由原来的值加5

    dogs+=5

    dogs=dogs+5=15+5=20

    print(dogs)
    if people > dogs:

    如果20>20 执行这句代码

     print("People are greater than or equal to dogs.")
    

    elif people < dogs:

    如果20<20执行这句代码

    print ("People are less than or equal to dogs.")
    

    else:

    如果20=20执行这句代码

    print  ("People are dogs.")
    

    执行结果

    图示.png

    相关文章

      网友评论

        本文标题:【Python爬虫】-第二周作业

        本文链接:https://www.haomeiwen.com/subject/umimlxtx.html