CodeAcademy Python Tip Calculator

Emil Natan shlyoko at gmail.com
Mon Sep 11 02:51:57 EDT 2017


To see output you should use function that prints to the output, for
example print(). You also do not calculate correctly the tax and tip, it is
percentage from the meal cost, so the tax to be added to the total meal
cost is meal * tax / 100.

meal = 44.50
tax = 6.75
tip = 15.0

tax_amount = meal * tax / 100
tip_amount = meal * tip / 100

print('Meal total: %.2f' % (meal + tax_amount + tip_amount))

If I remember correctly, you receive the above values as input to your
script. Use the input() and float() functions to accept value as input and
convert it to float.


On Mon, Sep 11, 2017 at 7:51 AM, Cai Gengyang <gengyangcai at gmail.com> wrote:

> 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 ?
> --
> https://mail.python.org/mailman/listinfo/python-list
>



More information about the Python-list mailing list