Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
NEED HELP NEW TO PYTHON!!
#1
Lightbulb 
Hello! Im new to coding in python I always found coding interesting and wanted to take a dive in it and so far its been understandable but I have come across a problem which is throwing me in a loop. The question is
" Write a program that prints the total bill, including tax and a 15% tip, for a meal that costs $8.00. The tax rate in Ontario is 13%.

The total bill will be the sum of the meal cost, the tax, and the tip.

Calculate the tax on the meal cost only (there should be no tax paid on the tip) and calculate the tip on the meal cost only (there should be no tip paid on the tax).

Don't worry if your answer gives more than two decimal places of accuracy."

Ive come up with this code and the solution:
print(8 + (8 * .13) + (8 * .15))
10.239999999999998

Now the next question is the one throwing me in the loop because the wording is confusing me but I also want to see first hand why the solution i putting is not the answer. Q :
"Now modify your program to be more generous. This time, you should calculate the tip on the meal plus the tax. The tax should still be calculated on the meal alone.

The meal cost is still $8.00 and the tax and tip rates are still 13% and 15%, respectively.

All you need to change is the calculation of the tip.

Don't worry if your answer gives more than two decimal places of accuracy."

My code/solution is:
print((8 + (8 * .13)) + (8 * .15))
10.239999999999998

and im still given wrong?
can someone help me see the solution around this.
Reply


Messages In This Thread
NEED HELP NEW TO PYTHON!! - by RZola - Aug-14-2021, 06:01 AM
RE: NEED HELP NEW TO PYTHON!! - by DPaul - Aug-14-2021, 07:02 AM
RE: NEED HELP NEW TO PYTHON!! - by perfringo - Aug-14-2021, 07:09 AM
RE: NEED HELP NEW TO PYTHON!! - by supuflounder - Aug-14-2021, 08:04 PM
RE: NEED HELP NEW TO PYTHON!! - by RZola - Aug-14-2021, 07:53 AM
RE: NEED HELP NEW TO PYTHON!! - by jefsummers - Aug-15-2021, 12:24 PM
RE: NEED HELP NEW TO PYTHON!! - by naughtyCat - Aug-24-2021, 08:20 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020