因此,我正在做一个学校项目,为票务工作者创建一个自动化的价格计算方法,到星期一到星期五,他们获得公司通行证,如果所有孩子都免费入场,但两天都没有坐太阳的话,他们将获得20%的折扣即使拥有会员也可以享受折扣
#a for adult b for kids and c for elderly
a = int(input("Numbers of adult: "))
b = int(input("Numbers of kids: "))
c = int(input("Numbers of elderly: "))
day = int(input("what day is is monday-1, tueday-2, wednesday-
4,.......sunday -7: "))
membership = int(input("what kind of membership 1 for corporate or 2 for
family 3 for no membership : "))
totalprice = (a*10.00) + (b*7.50) + (c*5.50)
tp = (("{:.2f}").format(totalprice))
kiddo=b*7.50
kid =(("{:.2f}").format(kiddo))
corporate = totalprice-(totalprice/100)*20
cp =(("{:.2f}").format(corporate))
ccorporate=(totalprice/100)*20
ccp = (("{:.2f}").format(ccorporate))
family = totalprice-(b*7.50)
fam = (("{:.2f}").format(family))
if membership == 1 and day == 1 or 2 or 3 or 4 or 5:
print("The original price before discount is $",tp,"after 20 percent
discount $",ccp," so the total price will be $",cp, )
elif membership == 2 and day == 1 or 2 or 3 or 4 or 5:
print("The original price is $",tp,"but after deduction of the kids
price $",kiddo," so the total price will be $",fam,)
elif membership == 1 or 2 or 3 and day != 6 or 7 :
print("The price will be $",totalprice,)
elif membership == 0 :
print("The total price is $",totalprice,)
else:
print("there is information enter incorrectly pls re-enter the info above.")
因此,即使没有会员晋升,即使在阳光下,它也能给我打折的价格。
Numbers of adult: 3
Numbers of kids: 3
Numbers of elderly: 3
what day is is monday-1, tueday-2, wednesday-4,.......sunday -7: 7
what kind of membership 1 for corporate or 2 for family 3 for no membership : 2
The original price before discount is $ 69.00 after 20 percent discount $ 13.80 so the total price will be $ 55.20
Process finished with exit code 0