Meal cost

What will this python program print?


The answer is 75.25.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

6 solutions

Sehaj Taneja
Mar 9, 2014

simple

yes its very simple

Carl De Guzman - 7 years, 2 months ago

too complicated...

Adrian Hansen - 7 years, 1 month ago
Jyojith Thaliath
May 1, 2014

in python,by default all the variables are of int type....therefore only whole number part is considered in the execution....therefore answer is 52+15+7=74

I thought python adds all the amounts first Can somebody check for me?

Austin Li - 1 year ago
Mayank Verma
May 1, 2014

Just addition :D

Angga Pranata
Apr 17, 2014

simply add all value there and get the result

Rafat Hossain
Feb 28, 2014

appetizers=52.75 ; dessert=15.50 ;

meal = dessert + appetizers = 52.75 + 15.50 = 68.25 ;

tip = 7 ;

total_cost = meal + tip = 68.25 + 7 = 75.25 ;

So, The program will print the result 75.25. (Ans.)

wow, you really have to show your solution.... did you even used a scratch for solving?

Adrian Hansen - 7 years, 1 month ago
Prasun Biswas
Feb 26, 2014

appetizers=52.75 and dessert=15.50 and tip=7

meal=dessert+appetizers=15.50+52.75=68.25

total_cost=meal+tip=68.25+7=75.25

print total cost will print the value stored in total cost which is 75.25 75.25 , so this program will print 75.25 75.25

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...