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

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jeremy Rohrer
    New Member
    • Oct 2010
    • 6

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

    Code:
    def main():
        BillAmount = raw_input('Enter the bill amount: ')
        TipAmount = CalcTip(check, total)
        
        print 'The tip on $&.2f is $%.2f.' % (BillAmount, TipAmount)
    
    def CalcTip():
        return 0
    
    #Call main
    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.
    Last edited by bvdet; Nov 18 '10, 03:17 PM. Reason: Add code tags
  • dwblas
    Recognized Expert Contributor
    • May 2008
    • 626

    #2
    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.

    Comment

    • bvdet
      Recognized Expert Specialist
      • Oct 2006
      • 2851

      #3
      It is simple as dwblas mentioned. Hint:
      Code:
      def CalcTip(bill, tip):
          return bill*tip

      Comment

      Working...