Quick question about Python


#1

I am meant to calculate the cost of the meal plus the tax and the tip

I type in my code as specified. (please see below as to what I have typed in)

however instead of receiving an answer in the right hand box the only response that comes up is "none"

What am I doing wrong? Shouldn't it calculate the answer for me? I have tried it with and without the spaces in the final equation. When I save and submit my code it says that its fine but it can't be if nothing is happening

meal = 44.50
tax = 0.0675
tip = 0.15

meal=meal+meal*tax

#2

Also why is typing

print("%.2f" % total)

so important to the final outcome?


#3

unless you use print python won't print anything to the output window, so that is why print is important. Its the whole purpose of print


#4

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