Different Results Between My Code and Code Academy Code


#1
#codeacademy
meal = 44.50
tax = 6.75 / 100
tip = 15.0 / 100

meal = meal + meal * tax

meal = meal + meal * tip 

print("%.2f" % total),
#mycode
meal = 44.50
restaurant_tax = 44.50 / 100 * 6.75
tip = 44.50 / 100 * 15.0
over_all_cost = meal + tip + restaurant_tax

print over_all_cost

So I tried writing my own version of the calculator before looking at the steps provided by code academy and our results turned out to be different. Can someone tell me what made it so that the results were different?

54.63–>codeacademy 54.17875–>mycode


#2

the difference is that you pay the tip over the meal cost exclusive tax, where as the codecademy code calculates the tip over the meal inclusive tax


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.