Question: This project is for Python 3.5.2 version. Create a program that will determine the cost per 3 serving for a giant sub sandwich you will

This project is for Python 3.5.2 version.

Create a program that will determine the cost per 3" serving for a giant sub sandwich you will be ordering for a get-together with your friends.

Within main(), get the input of the length in inches for the sub and the cost.

Create function named numServings() that will receive the length in inches and return the number of servings. Each 3" is considered a serving. Servings should be a whole number, so you will need to find a way to drop the fraction and return only the integer portion. You should call this function from within main() AND return the number of servings to main().

Then create a function named costPerServing(). This function which will receive both the cost of the giant sub and the number of servings. This function will return the cost per serving. Call the function from within main().

Then, within main(), print the cost per serving using this format: $2.98 AND print the number of servings! Test data: Enter 46 inch sub for $40 - your program should print 15 servings at $2.67 per serving.

THEN, put the code in main() inside a loop. The loop will ask the user if they want to enter information for another sub sandwich. If so, data is requested and everything including the print statements process again!

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 Databases Questions!