Tip Calculator

Lesson 01/05 – The Meal

[code lang=”python”]

Assign the variable meal the value 44.50 on line 3!

meal = 44.50
[/code]

Lesson 02/05 – The Tax

[code lang=”python”]
meal = 44.50
tax = 0.0675
[/code]

Lesson 03/05 – The Tip

[code lang=”python”]

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

meal = 44.50
tax = 0.0675
tip = 0.15
[/code]

Lesson 04/05 – Reassign in a Single Line

[code lang=”python”]

Reassign meal on line 7!

meal = 44.50
tax = 0.0675
tip = 0.15

meal = meal + meal * tax
[/code]

Lesson 05/05 – The Total

[code lang=”python”]

Assign the variable total on line 8!

meal = 44.50
tax = 0.0675
tip = 0.15

meal = meal + meal * tax
total = meal + meal * tip

print("%.2f" % total)
[/code]

 

Leave a Reply

Your email address will not be published. Required fields are marked *

To create code blocks or other preformatted text, indent by four spaces:

    This will be displayed in a monospaced font. The first four 
    spaces will be stripped off, but all other whitespace
    will be preserved.
    
    Markdown is turned off in code blocks:
     [This is not a link](http://example.com)

To create not a block, but an inline code span, use backticks:

Here is some inline `code`.

For more help see http://daringfireball.net/projects/markdown/syntax