ADRIAN KELLY wrote:
how would i show the discount in main?
Look at your shop() function:
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
It calculates the discount, and then does nothing with it except throw the answer away. So the first thing you need is to return the checkout and the discount:
return (checkout, discount) Now look at main():
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
It collects the total spent, but needs to collect both total and discount: total, discount = shop(spend) -- Steven _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor