Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import sys
- def voucher(discount):
- if havecode == "yes" or havecode == "Yes":
- code = input("Enter voucher code : ")
- if code == "20%OFFYESPLS" or code == "GIMME20%OFF":
- discount = total_order * 20/100
- pay = total_order - discount
- print("Congrats! You got a 20% discount!")
- print()
- print("Final total...$" , pay)
- print("THANKS")
- sys.exit()
- else:
- print()
- print("Sorry not a valid voucher.")
- tryagain = input("Would you like to re-input? ")
- if tryagain == "yes" or tryagain == "Yes" :
- voucher(discount)
- else :
- novoucher()
- print()
- novoucher()
- return tryagain
- else:
- novoucher()
- def novoucher ():
- if int(total_order) > 100 :
- discount = total_order * 10/100
- pay = total_order - discount
- print()
- print("For purchase above $100. You got a 10% discount")
- print("and a free tea!")
- print()
- print("Final total...$" , pay)
- print("THANKS")
- sys.exit()
- return discount
- else :
- print("Final total...$" , total_order)
- total_order = int(input("Enter total order: $"))
- havecode = input("Use a voucher code? ")
- if havecode == "yes" or havecode =="Yes":
- voucher(20)
- else :
- novoucher()
- #Talice~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement