python计算折扣价_在python中使用ifelifelse创建折扣计算

很抱歉,我对这件事太陌生了,这一切让我很困惑。我搜索了这些问题,但似乎找不到答案。我对每件事都很满意,直到它问你买了多少包为止。我想让程序来决定所采用的折扣率。然后我希望程序计算的金额到期;折扣率将被应用和最终金额将由客户支付。这真的让我很沮丧,因为我不知道从哪里开始。我认为最好的方法是用if-elif-else,但很明显我可能错了。如有任何帮助,我们将不胜感激。在print "Bags Discount Calculator"

print "Please follow he on screen instructions"

print "--------------------------------------- "

print "Rate of Discount based on the following:"

print "____________________________________________"

print "Number of Bags: Rate of Discount:"

print "____________________________________________"

print "Less than 25 0%"

print "From 25-49 5%"

print "From 50-99 10%"

print "100 or more 20%"

print "_____________________________________________"

password=raw_input ("Please enter your password:")

if (password=="di8count"):

print ("\n\tPasssword accepted")

numberofbags=raw_input ("Enter number of bags purchasd:")

if (numberofbags<25):

discountRate = .05

else:

print("\n\tIncorrect Password. Please try again.")

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值