#if条件句单分支结构
money=int(input("请输入总价"))
if money<=100:
print("您的账户即将不足","剩余金额为",money)
#if条件句双分支结构
money=int(input("请输入总价"))
if money<=100:
print("您的账户即将不足","剩余金额为",money)
else:
print("支付后剩余金额为",money-100)
#if条件句多分支结构
money=int(input("请输入总价"))
if 600<money:
print("打五折,价格为",money*0.5)
elif 300<money<=600:
print("打七折,价格为",money*0.7)
elif 100<money<=300:
print("打九折,价格为",money*0.5)
else:
print(money)
#if条件句嵌套
money=int(input("请输入总价"))
if 100<money:
if money>300:
print("亲爱的会员享受八折优惠",money*0.8)
else:
print("亲爱的会员享受九折优惠",money*0.9)
else:
print(money)
|