Tip Calculator

Here I am sharing the solutions from “Tip Calculator” – Python (www.codecademy).

I Paying the Bill 

i The Meal 1/5

meal = 44.50

ii. The Tax 2/5

meal = 44.50
tax = 6.75/100

iii.  The Tip 3/5

meal = 44.50
tax = 0.0675
tip = 15.0/100

iv. Reassign in a Single Line 4/5

meal = 44.50
tax = 0.0675
tip = 0.15
meal = meal + meal*tax

v. The Total 5/5

meal = 44.50
tax = 0.0675
tip = 0.15

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

print(“%.2f” % total)

 

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s