【Python】软件测试--佣金问题

最近光剩下写这种无聊练习题了,不说废话,问题如下:
在这里插入图片描述

Code:

问题简单,无需注释
lockPrice = 45
stockPrice = 30
barrelPrice = 25

lockNum = int(input("枪机数量:"))
stockNum = int(input("枪托数量:"))
barrelNUm = int(input("枪管数量:"))

if lockNum < 1 or stockNum < 1 or barrelNUm < 1:
    exit("未达标,不予计算!")

if lockNum > 70 or stockNum > 80 or barrelNUm > 90:
    exit("虚报销售数量,不予计算!")

allCash = lockNum * lockPrice + stockNum * stockPrice + barrelNUm * barrelPrice
if allCash > 1800:
    profit = (allCash - 1800) * 0.2 + 800 * 0.15 + 1000 * 0.1
elif allCash > 1000:
    profit = (allCash - 1000) * 0.15 + 1000 * 0.1
else:
    profit = allCash * 0.1

print("=" * 30)
print("销售枪机数量:%d" % lockNum)
print("销售枪托数量:%d" % stockNum)
print("销售枪管数量:%d" % barrelNUm)
print("总销售额:%d" % allCash)
print("总利润为:%d" % profit)
print("=" * 30)

Picture:

在这里插入图片描述

发布了44 篇原创文章 · 获赞 68 · 访问量 5130

猜你喜欢

转载自blog.csdn.net/qq_25404477/article/details/100752120