By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
444,089 Members | 2,432 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 444,089 IT Pros & Developers. It's quick & easy.

How do I add a code in so it will put out a Tip Amount on a Bill??

P: 6
Expand|Select|Wrap|Line Numbers
  1. def main():
  2.     BillAmount = raw_input('Enter the bill amount: ')
  3.     TipAmount = CalcTip(check, total)
  4.  
  5.     print 'The tip on $&.2f is $%.2f.' % (BillAmount, TipAmount)
  6.  
  7. def CalcTip():
  8.     return 0
  9.  
  10. #Call main
  11. main()
I just need it to print out the calculation for a 15% tip. This is all I have and I have no idea what else to do. Please Help. Thank You.
Nov 18 '10 #1
Share this Question
Share on Google+
2 Replies


Expert 100+
P: 624
The tip is 15% times the bill amount. This is very simple code and so you should figure it out how to mulitply for yourself.
Nov 18 '10 #2

bvdet
Expert Mod 2.5K+
P: 2,851
It is simple as dwblas mentioned. Hint:
Expand|Select|Wrap|Line Numbers
  1. def CalcTip(bill, tip):
  2.     return bill*tip
Nov 18 '10 #3

Post your reply

Sign in to post your reply or Sign up for a free account.