From: kellyadr...@hotmail.com
To: kellyadr...@hotmail.com
Subject: RE: How do i show discount?
Date: Sat, 19 Nov 2011 23:34:27 +0000








sorted it guys, used a third function....

 

  

Adrian 


From: kellyadr...@hotmail.com
To: tutor@python.org
Subject: How do i show discount?
Date: Sat, 19 Nov 2011 22:41:37 +0000













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!!!!!!!!

                                                                                
                                          
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to