Question: Write code snippets to do the following. You should write these in a Python editor and test them out as you go. When they work,

Write code snippets to do the following. You should write these in a Python editor and test them out as you go. When they work, copy and paste your final code snippet here.

Definea function that takes a total bill and the number of people at your table, and prints the amount that each person owes.

e.g. divide_bill(100, 5) would produce

Each person owes $20 for their meal.

e.g. divide_bill(50.25, 4)would produce

Each person owes $12.56 for their meal.

Note that the decimal number above may not be exactly the same as what you get. Yours might say 20.0 or 12.5625, for instance. Well learn about how to round to exactly two decimal points later (for Added Fun you could google how to do it now).

Make sure that you test your function by calling it at least twice in your main with different parameters.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!