Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I need help understanding how to start these problems and how to answer them. I am not dumb I just need help. For all of

I need help understanding how to start these problems and how to answer them. I am not dumb I just need help.

For all of the 5 programs, you must do the following:

Place a preamble at the beginning of each program. (See the sample preamble in Content). DO NOT USE THE DOCSTRING IN PREAMBLES

Save each program in its own Python source file. (Not all in one file.)

Use only Python statements taught in Chapter 2 (for program 2 see Note below).

Create meaningful prompts for input and output as shown in the book examples.

When complete, combine all three programs into one zip file and attach it to the appropriate link by the due date.

DO NOT SUBMIT INTERACTIVE MODE (Shell) SESSIONS

NOTE: To find the absolute difference between 2 numbers, use the abs() method.

Eg: The absolute difference between -2 and 1 is 3

So, the syntax would be abs(-2-1) or abs(1-(-2)) which is 3

More Eg: abs(-77.08) will be 77.08, an unsigned value

Use the IDLE editor to create Python source code in a .PY format file to complete each of the following programs:

Write a program that prompts the user for a distance to travel (in miles) and a speed (in mph) and outputs time of arrival in hours. Name your program: Speed.py. Always program distance values anticipating decimal points, like Example 3. Format all output floating-point values to 4 digits.

EXAMPLE:

Example 1

Example 2

Example 3

Input

72 60

1282 85

120.5 59.2

Output

1.2000

15.0823

2.0355

Note: Output needs to match the examples.

A "Point Spread" is a term used to in sports (and gambling) to describe the difference between two teams' scores. For example, if one team scores 20 points and another team scores 30 points, the point spread is 10. A point spread is always a positive number without decimal points.

Write a Python program that prompts the user for two sports game scores and outputs the point spread. Name your program: PointSpread.py EXAMPLE:

Example 1

Example 2

Example 3

Input

8 15

89 103

42 14

Output

7

14

28

Note: Output must match exactly.

Write a Python program Write an algorithm that prompts the user for three sports game scores and outputs the average. Name your program: AverageScores.py. Round all output floating-point values to 2 digits.

EXAMPLE:

Example 1

Example 2

Example 3

Input

8 15 12

89 103 63

14 42 36

Output

11.67

85.00

30.67

Note: Output must match (within a predefined tolerance).

It is possible to name the days 0 through 6 where day 0 is Sunday and day 6 is Saturday. If you go on a wonderful holiday leaving on day number 3 (a Wednesday) and you return home after 10 nights you would return home on a Saturday (day 6) Write a general version of the program which asks for the starting day number, and the length of your stay, and it will tell you the number of day of the week you will return on.

Write a program that asks the user for the amount of money he/she has on hand, and outputs the number of girl scout cookies that he/she can purchase. Use the following prices: $5 per box for the "Super Six" (Thin Mints, Samoas, Tagalongs, Do-Si-Dos, Trefoils, Savannah Smiles) $6 per box for the Specialty Cookies (S'mores, Toffee-tastic)

For this problem, assume that the user will buy all of one or the other. In other words, output the number of boxes that he/she would be able to obtain if he/she bought nothing but the Super Six, and nothing but the Specialty Cookies.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

4 How can you create a better online image for yourself?

Answered: 1 week ago