程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
您现在的位置: 程式師世界 >> 編程語言 >  >> 更多編程語言 >> Python

[Python] software testing -- Commission issues

編輯:Python

Recently, I only have to write such boring exercises , Don't say nonsense , Questions as follows :

Code:

 The problem is simple , No comments required
lockPrice = 45
stockPrice = 30
barrelPrice = 25
lockNum = int(input(" Number of guns :"))
stockNum = int(input(" Number of butts :"))
barrelNUm = int(input(" Number of barrels :"))
if lockNum < 1 or stockNum < 1 or barrelNUm < 1:
exit(" Not up to standard , Not calculated !")
if lockNum > 70 or stockNum > 80 or barrelNUm > 90:
exit(" Misrepresentation of sales quantity , Not calculated !")
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(" Number of guns sold :%d" % lockNum)
print(" Number of butts sold :%d" % stockNum)
print(" Number of barrels sold :%d" % barrelNUm)
print(" Total sales :%d" % allCash)
print(" The total profit is :%d" % profit)
print("=" * 30)

Picture:


  1. 上一篇文章:
  2. 下一篇文章:
Copyright © 程式師世界 All Rights Reserved