This forum is now read-only. Please use our new forums! Go to forums
A BLUNDER MISTAKE!!
The actual result should be something else then what they are teaching us!
consider this
Cost of meal: $44.50
Restaurant tax: 6.75%
Tip: 15%
The cost of meal is $44.50, The restaurant tax for 6.75% of cost of meal(i.e $44.50) gets to $3.00375 & The tip of 15% of COST OF MEAL(i.e$44.50) gets to $6.675
The Total cost of meal is meal + tax + tip = 44.50+3.00375+6.675 = $54.17875
SO, THE TOTAL COST SHOULD BE $54.17875 INSTEAD OF $54.63 AS WHAT THEY TEACH US!!!
THIS IS BECAUSE, they calculate the tip of 15% on the meal + tax(i.e $47.50375) instead of actual meal cost (i,e $44.50) which shows the difference!!
They teach us this way..
meal = 44.50 tax = 0.0675 tip = 0.15
meal = meal + meal*tax
total = meal + meal*tip
print(“%.2f” % total)
But the correct one is!
meal = 44.50 tax = 0.0675 tip = 0.15
meal = meal + meal*tax
total = meal + 44.50*tip
print(“%.2f” % total)
♥simply SIMPLE!!♥
Answer 547761f252f863cef7003484
Sorry Eric, this disappointed me! I thought the place where I learn is the place where professionals teach! yeah!!, consider this fact “Amateurs Built The Ark, Professionals Built The Titanic.”:P
Answer 5477c424631fe94de8004b41
Many people apply the tip rate to the cost of the meal without the tax, then add the tax on afterward, which is what you suggested. But, if you do it that way, it would be best to only use the numerical constant for the meal amount once in the code. You have 44.50
in two places, which does produce the result you wanted, but it makes more work if you would like to change the starting value of the meal to another amount.
The following would be better …
meal = 44.50
tax = 0.0675
tip = 0.15
total = meal + meal * tax + meal * tip
print("%.2f" % total)
With that revision, you only need to make a change in one place, if you decide to use a different starting cost for the meal
.
The submission correctness test (SCT) for this exercise does not accept this solution, because it does not comply with the instructions. But it is a nice variation to the exercise.
Answer 547b625152f863ad22008628
Hey really, relax and don’t make such a big deal about such a small issue. When you pay your bill at a restaurant, you calculate the tip as you will. But for purposes of following instructions so the Python Code reader can read your submission, follow the instructions.
Answer 547ca59b282ae39b1c00cf32
They clearly state from the beginning of the exercise the tip will be applied to the overall cost of the meal, INCLUDING TAX. And they repeatthat the tip will include the tax at 4/5. Not a mistake, you just have to read more carefully next time ;)
1 comments
INDEED YOU HAVE TO READ CAREFULLY!!
I never said that “they stated from the beginning of the exercise the tip will be applied to the overall cost of the meal, NOT INCLUDING TAX”
I clearly said “The actual result should be something else then what they are teaching us!” which mean they teach us wrong and NOT THAT ‘I HAD READ WRONG!’-
Popular free courses
- Free Course
Learn SQL
In this SQL course, you'll learn how to manage large datasets and analyze real data using the standard data management language.Beginner friendly,4 LessonsLanguage Fluency - Free Course
Learn JavaScript
Learn how to use JavaScript — a powerful and flexible programming language for adding website interactivity.Beginner friendly,11 LessonsLanguage Fluency - Free Course
Learn HTML
Start at the beginning by learning HTML basics — an important foundation for building and editing web pages.Beginner friendly,6 LessonsLanguage Fluency
1 comments
Sadly, neither work