Cat brother teach you to write 007 reptile conditional and nested conditions - smaller jobs

Small operations

练习介绍:
在灭霸打了一个响指,宇宙一半生物都灰飞烟灭。
剩下的复仇者联盟成员们依旧没有放弃反击灭霸的机会,他们决定利用最后一次行动机会,去把灭霸手里的宝石偷回来。
如果偷回的宝石数是4颗及以上,便获得了打败灭霸的力量;如果偷回的宝石数是1-3颗,他们可以全员出动,殊死一搏;如果偷回的宝石数是0颗,只能尝试呼叫惊奇队长。
最终,他们因为实力相差太大,1颗宝石都没有偷回来。  
题目要求:
请你写出一段代码,在一颗宝石都没偷回来的赋值下,进行条件判断,并产生对应的结果:  
1.如果偷回的宝石数是4颗及以上,输出结果获得了打败灭霸的力量,反杀稳了
2.如果偷回的宝石数是1-3颗,输出结果可以全员出动,殊死一搏
3.如果偷回的宝石数是0颗,输出结果没办法了,只能尝试呼叫惊奇队长
注意:标点符号都为英文格式
复制代码

2 small jobs

练习介绍:
复仇者联盟的成员也是有工资的,然而,由于美国队长一直被冰封在北极,错过了多次调薪机会,所以美国队长的工资一直是每月80美元。光荣挺进史塔克穷人榜前三名,并获封“美元队长”称号。  
题目要求:
请你写出一段代码,判断美国队长的工资水平,代码需要满足如下条件:
1.如果月工资小于等于500美元,显示“欢迎进入史塔克穷人帮前三名”
  1.1如果月工资在100-500美元之间,显示“请找弗瑞队长加薪”
  1.2如果月工资小于等于100美元,显示“恭喜您荣获“美元队长”称号!”
2.如果月工资在500-1000美元之间(含1000美元),打印“祝贺您至少可以温饱了。”
3.其他情况下,如果工资大于1000美元,打印“经济危机都难不倒您!”
  3.1如果工资在1000-20000美元(含20000美元)之间,打印“您快比钢铁侠有钱了!”
  3.2如果月工资大于20000美元,打印“您是不是来自于瓦坎达国?”
4.不管赋值改变后输出结果如何,都需固定打印结果“程序结束”
复制代码

Answer a

stonenumber = 0
if stonenumber >= 4:
    print('获得了打败灭霸的力量, 反杀稳了...')
elif 1<= stonenumber < 4:
    print('可以全员出动, 输死一搏...')
else:
    print('没办法了, 只能尝试呼叫惊奇队长...')
复制代码

The second was

salary = 66666
if salary <= 500:
    print('欢迎进入史塔克穷人帮前三名')
    if 100 <= salary <= 500:
        print('请找弗瑞队长加薪')
    else:
        print('恭喜您获得"美元队长"的称号')
elif 500 < salary <= 1000:
    print('祝贺您, 至少可以温饱了...')
else:
    print('经济危机都打不倒您...')
    if salary < 20000:
        print('您快比钢铁侠有钱了...')
    else:
        print('您是否来自于瓦坎达?')
print('程序结束')
复制代码

Quick Jump:

Cat brother teach you to write reptile 000-- begins .md
cat brother teach you to write reptile 001 - print () functions and variables .md
cat brother teach you to write reptile 002-- job - Pikachu .md print
cat brother teach you to write reptiles 003 data type conversion .md
cat brother teach you to write reptile 004-- data type conversion - small practice .md
cat brother teach you to write reptile 005-- data type conversion - small jobs .md
cat brother teach you to write reptile 006- - conditional and nested conditions .md
cat brother teach you to write 007 reptile conditional and nested conditions - small operating .md
cat brother teach you to write reptile 008 - input () function .md
cat brother teach you to write reptiles 009 - input () function - AI little love students .md
cat brother teach you to write a list of 010 reptiles, dictionaries, circulation .md
cat brother teach you to write reptile 011-- lists, dictionaries, circulation - small jobs .md
cat brother teach you to write a Boolean value, and four reptile 012-- statements .md
cat brother teach you to write a Boolean value, and four reptile 013-- statements - smaller jobs .md
cat brother teach you to write reptile 014 - pk game. md
cat brother teach you to write reptile 015 - pk game (new revision) .md
cat brother teach you to write reptile 016-- function .md
cat brother teach you to write reptile 017-- function - a small job .md
cat brother to teach you write reptile 018--debug.md
cat brother teach you to write reptile 019 - debug- job. md
cat brother teach you to write reptiles 020-- Classes and Objects (on) .md
cat brother teach you to write reptiles 021-- Classes and Objects (a) - Job .md
Cat brother teach you to write reptiles 022-- Classes and Objects (lower) .md
cat brother teach you to write reptiles 023-- Classes and Objects (lower) - Job .md
cat brother teach you to write reptile 024-- decoding coded && .md
cat brother teach you to write reptile 025 && decoding coded - small jobs .md
cat brother teach you to write reptile 026-- module .md
cat brother teach you to write reptile 027-- module introduces .md
cat brother teach you to write reptile 028- - introduction module - small job - billboards .md
cat brother teach you to write Preliminary -requests.md reptile reptilian 029--
cat brother teach you to write reptile reptilian 030-- Preliminary -requests- job .md
cat brother teach you to write 031 reptiles - reptile basis -html.md
cat brother teach you to write reptile reptilian 032-- first experience -BeautifulSoup.md
cat brother teach you to write reptile reptilian 033-- first experience -BeautifulSoup- job .md
cat brother teach you to write reptile 034- - reptile -BeautifulSoup practice .md
cat brother teach you to write 035-- reptile reptilian -BeautifulSoup practice - job - film top250.md
cat brother teach you to write 036-- reptile reptilian -BeautifulSoup practice - work - work to resolve .md movie top250-
cat brother teach you to write 037-- reptile reptiles - to listen to songs .md baby
cat brother teach you to write reptile 038-- arguments request .md
cat brother teach you to write data stored reptile 039-- .md
cat brother teach you to write reptiles 040-- store data - Job .md
cat brother teach you to write reptile 041-- analog login -cookie.md
Cat brother teach you to write reptile 042 - session usage .md
cat brother teach you to write reptile 043-- analog browser .md
cat brother teach you to write reptile 044-- analog browser - job .md
cat brother teach you to write reptiles 045-- coroutine .md
cat brother teach you to write reptile 046-- coroutine - practice - what to eat not fat .md
cat brother teach you to write reptile 047 - scrapy framework .md
cat brother teach you to write reptile 048-- .md reptile reptiles and anti-
cat brother teach you to write reptile 049-- end Sahua .md

Reproduced in: https: //juejin.im/post/5cfbded6f265da1ba9156fce

Guess you like

Origin blog.csdn.net/weixin_33688840/article/details/91465275