Calculations and Variables

ferzan saglam ferzans97 at gmail.com
Thu Oct 31 14:46:23 EDT 2019


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)	 	       	  	  	  	    	   	
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


More information about the Python-list mailing list