Restaurant Bill

ferzan saglam ferzans97 at gmail.com
Thu Oct 31 16:45:29 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.


print('Enter the total cost of the meal')	 	       	  	  	  	    	   	
Total_cost= input()	 	       	  	  	  	    	   	
	 	       	  	  	  	    	   	
print('Enter how much the tip is')	 	       	  	  	  	    	   	
Tip= input()	 	       	  	  	  	    	   	
	 	       	  	  	  	    	   	
print('Enter how many people there are')	 	       	  	  	  	    	   	
People= input()	 	       	  	  	  	    	   	
	 	       	  	  	  	    	   	
Total_cost = (Tip + Total_cost) / People	 	       	  	  	  	    	   	
	 	       	  	  	  	    	   	
print('Each person will have to pay')	 	       	  	  	  	    	   	
print(Total_cost)	 	       	  	  	  	    	   	
	 	       	  	  	  	    	   	
(Total_cost * 9) / 100



I am aiming for the result of 43.6, but somehow get the result of 41.8.
(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