Calculations and Variables
Gary Herron
gherron at digipen.edu
Thu Oct 31 15:08:19 EDT 2019
On 10/31/19 11:46 AM, ferzans97 at gmail.com wrote:
> The code below which I have written should print the result of 43.6 with the given values I have included at the end of this question, but for some odd reason I get the result of 44.44.
>
>
> bill = (input("Enter the total cost of the meal: \n"))
> tip = (input("Enter how much the tip is: \n"))
> split = (input("Enter how many people there are: \n"))
> total = bill + (bill / tip)
Don't you mean
total = bill + (bill * tip) ?
>
> eachPay = total / split
> print("Each person will have to pay %.2f" % eachPay)
>
>
>
> I am aiming for the result of 43.6, but somehow get the result of 44.44.
> (meal cost: 200) (Tip: 9) (people: 5)
>
> I seem to do the calculation below, but get different results each time.
> Total * Percentage Amount / 100
--
Dr. Gary Herron
Professor of Computer Science
DigiPen Institute of Technology
(425) 895-4418
More information about the Python-list
mailing list