Computer Skills for Problem Solving

| 0

PROBLEM #1: Suppose we wanted to compute the mileage (average mile per gallon) for a trip. We would like the user to input the beginning odometer reading, ending odometer reading, and the number of gallons used. All three of these will be floating point numbers. The program should use this information to compute the distance traveled and then the miles per gallon. Those two values should be output to the screen.

1. (a) Create an algorithm to solve the problem described above. Save your algorithm as a Word document.

(b) Convert your algorithm from part (a) to a flowchart. Be sure to include the textbox with your name, description, cs135, and date. Export this flowchart as a PDF document.

(c) Write a Python program to solve the above problem. Be sure to include at least 4 lines of comments as you did in Activity #9. Once your program has been tested and is working correctly, copy and paste it to a new Word document.

2. Write a Python program that will determine change for a dollar. The input will be amount of the item to be purchased. This will be an integer. Use the Canvas video that provided this algorithm as a guide. Be sure your program includes four lines of comments similar to other programs. Once your program has been tested and is working correctly, copy and paste it to a new Word document.

Computer Skills for Problem Solving

Activity #9 – Introduction to Python – Part I

1. Watch the video on Canvas titled “Introduction to Python”

1. (a) Visit http://repl.it

(b) Where it says “Search for a Language”, choose Python3

(c) Where it says “Main.py”, type the following Python program:

# Program was written by XXX XXXX

# CS 135 – Computer Skills for Problem Solving

# Activity #9

# Due: July 9, 2018

a = 3+5

b = 3-5

c = 3*5

d = 33/5

e = 33//5

f = 33%5

g = 3**5

h = “dog” + “house”

print(a)

print(b)

print(c)

print(d)

print(e)

print(f)

print(g)

print(h)

(d) Before running this program, try to guess the output. Click on the “Run” button to execute the program.

(e) If you don’t understand any of the lines of output, try using Python tutorials / web sites to find the answers.

(f) Copy the 8 lines of output into a new Word document.

1. Create a new Python program that will use the print statement to print the following four lines:

• Your experience level in computer programming

Run your program to verify that it will indeed print the four lines from above.

Add four lines of comments (see the first 4 lines of the previous program that begin with pound signs) to the beginning of your program.

When your program is working correctly, copy it to your Word document.

1. Write a Python program that will compute the cost of putting a fence around a rectangular yard. There will be 3 inputs (length of yard, width of yard, cost per foot of fence). All of these will be floating point numbers. Use the Canvas video that provided this algorithm as a guide. Be sure your program includes four lines of comments at the top similar to the first two programs.

When your program is working correctly, copy it to your Word document.

How to submit: Submit the Word document described in this assignment to Canvas under Activity #9.

Computer Skills for Problem Solving

Activity #10 – Introduction to Python – Part II

PROBLEM #1: Suppose we wanted to compute the mileage (average mile per gallon) for a trip. We would like the user to input the beginning odometer reading, ending odometer reading, and the number of gallons used. All three of these will be floating point numbers. The program should use this information to compute the distance traveled and then the miles per gallon. Those two values should be output to the screen.

1. (a) Create an algorithm to solve the problem described above. Save your algorithm as a Word document.

(b) Convert your algorithm from part (a) to a flowchart. Be sure to include the textbox with your name, description, cs135, and date. Export this flowchart as a PDF document.

(c) Write a Python program to solve the above problem. Be sure to include at least 4 lines of comments as you did in Activity #9. Once your program has been tested and is working correctly, copy and paste it to a new Word document.

1. Write a Python program that will determine change for a dollar. The input will be amount of the item to be purchased. This will be an integer. Use the Canvas video that provided this algorithm as a guide. Be sure your program includes four lines of comments similar to other programs. Once your program has been tested and is working correctly, copy and paste it to a new Word document.

How to submit: Submit the 4 documents described above to Canvas under Activity #10.

Last Updated on February 11, 2019 by EssayPro