473,320 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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

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
2 1228
dwblas
626 Expert 512MB
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
2,851 Expert Mod 2GB
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

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

Similar topics

3
by: Tommo | last post by:
Hello All, I am a still learning so be easy on me. I am trying to get some code to work that is using JS and Perl/CGI, I am using AS Perl and an Apache Server on XP as the webserver. Can anyone...
2
by: DazedAndConfused | last post by:
I have legacy C code that I'm able to compile using VS6 using the following command: "cl -GX -O2 -DMSWIN32 -DNDEBUG -D_WINDOWS -c mycode.c" When I run this same command using the VS .NET 2003...
1
by: Tim ffitch | last post by:
Hi I have an MDE database that stores all 17000000 UK Postcodes. This database also includes a custom function and data type to return map grid coordinates for a given postcode. I have set a...
2
by: Supra | last post by:
this code will worked. i can connected to any servers...but how do i added method called doColor from usercontrol to module Sub DisplayMessage(ByVal rtb As RichTextBox, ByVal sText As String,...
6
by: Nick | last post by:
Hi, Can anyone take a look at the code below and suggest why it may not be working --------------------------------- Dim test As ImageButton test =...
2
by: Rhys.Mataira | last post by:
My code will not show up anything at all on the screen can someone guide me why this would be? <?php $pagetitle="Login"; If (!$_POST) or (!$_POST) { echo" <head></head> <style...
6
by: spooky | last post by:
hii guyzz Im doing a project which requires that i have a drop down for the country and i require to populate another drop down for state.
10
by: Chris Thomasson | last post by:
I am working on a high-speed futures implementation in C++, and was tinkering around with ways to wrap the function pointer logic. I am a C/Assembly programmer that doesn't make a lot of use of...
2
by: Laphan | last post by:
Hi All Please, please help. I'm not completely thick, but php terminology for getting and installing extensions is soooo confusing to me. All I want to do is use the following code: <?php
1
anoble1
by: anoble1 | last post by:
I have an excel sheet with 5 worksheets inside it (5 tabs). I have 3 columns that I want to hide unless their NTID is asnoble. If they arn't me then hide the 3 coluns on all the sheets. The way it...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.