Python Tip Calculator. Answer sheet Task 1 # Assign the variable meal the value 44.50 on line 3! Favourite meal meal = 44.50 Task 2 meal = 44.50 The Tax tax = 0.0675 Task 3 # You're almost there! Assign the tip variable on line 5. The Tip meal = 44.50 tax = 0.0675 tip = 0.15 Task 4 # Reassign meal on line 7! Reassign in a single line meal = 44.50 tax = 0.0675 tip = 0.15 meal = meal + meal * tax Task 5 # Assign the variable total on line 8! Calculate it meal = 44.50 tax = 0.0675 tip = 0.15 meal = meal + meal * tax total = meal + meal * tip print("%.2f" % total) Remember… Python is case sensitive. Variables must be in lowercase and Boolean must be titlecase Whitespace is important and must be used correctly. Do not use tab, use 4 spaces to indent code. # key for a single line comment. 3 speech marks to open and close a multi-line comment
Python Tip Calculator. Answer sheet Task 1 Favourite meal # Assign the variable meal the value 44.50 on line 3! meal = 44.50 Task 2 The Tax meal = 44.50 tax = 0.0675 Task 3 The Tip # You're almost there! Assign the tip variable on line 5. meal = 44.50 tax = 0.0675 tip = 0.15 Task 4 Reassign in a single line # Reassign meal on line 7! meal = 44.50 tax = 0.0675 tip = 0.15 meal = meal + meal * tax Task 5 Calculate it # 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) Remember… Python is case sensitive. Variables must be in lowercase and Boolean must be titlecase Whitespace is important and must be used correctly. Do not use tab, use 4 spaces to indent code. # key for a single line comment. 3 speech marks to open and close a multi-line comment
Python%20Tip%20Calculator%20Answer%20Sheet.docx