Program[00]-Tip Calculator

来源:互联网 发布:移动数据流量叠加卡 编辑:程序博客网 时间:2024/05/18 02:01

1.The Meal

Now let’s apply the concepts from the previous section to a real world example.
You’ve finished eating at a restaurant, and received this bill:

  • Cost of meal: $44.50
  • Restaurant tax: 6.75%
  • Tip: 15%

    How much you should pay the bill?

meal = 44.50tax = 6.75 / 100tip = 15.0 / 100meal = meal + meal * taxtotal = meal + meal * tipprint("%.2f" % total)
>>>54.63
原创粉丝点击