[Tutor] How do i show discount?

ADRIAN KELLY kellyadrian at hotmail.com
Sat Nov 19 23:41:37 CET 2011







def shop(total_spend):    min_spend=25    discount_amount=150    discount=0.05    if total_spend >= min_spend and total_spend > discount_amount:        checkout=total_spend-(total_spend*discount)        discount=total_spend*discount    else:        checkout = total_spend        discount = 0    return checkout

def main():    spend = input('Enter the amount you spent: ')    while spend<25:        print "Error, min spend is €25 in this shop!"        spend = input('Enter the amount you spent: ')    else:        total = shop(spend)        print 'Your bill comes to',total,"\n","your discount was",discount
main ()  
#program works but how would i show the discount in main? I saved as text file in notepad........!  Many thanks!!!!!!!!

 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20111119/b2958f54/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: shop_discount2.py
Type: text/x-script.phyton
Size: 686 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/tutor/attachments/20111119/b2958f54/attachment-0001.bin>


More information about the Tutor mailing list