Python Codeacademy Tip Calculator


#1

So, I’m on section (3. The Tip) …

Instructions
1.
Set the variable tip to decimal value of 15% on line 5.

This was my input:

You’re almost there! Assign the tip variable on line 5.

meal = 44.50
tax = 6.75 / 100
tip = 15.0

But, when I tried to run the program, I don’t get any output at all. Nada, nothing zilch. Nothing happens, how come ?


#2

tip = 15.0, 15.0 is not the decimal value of 15%

look at tax:

tax = 6.75 / 100

here you set the decimal value of 6.75%

also, there is no output given you never print anything, you only declare variable

displaying output to the user is always a very small part of your program


#3

By the way, in stead of 6.75/100 you can also input directly 0.0675. Just exactly the same value.
And in stead of calculating the tax and then summon values, you can do much shorter with this formula;
6,75% tax on 80 is equal to
80 * 1,0675

12% tax off 75 is equal to
75 / 1.12

MUCH easier


#4

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