Due Date: midnight, Friday, 9 November.
This assignment focuses on decisions from Chapter 7.
Submit the following programs via Blackboard:
- (From Chapter 7, #3, Page 230) A certain CS professor gives 100-point exams that graded on
- A: 90-100
- B: 80-89
- C: 70-79
- D: 60-69
- F: 0-59
Write a program that accepts an exam score as input and uses a decision structure to calculate the
corresponding letter grade.
- Write a function that takes as a parameter the zone and returns the Long Island Railroad fare.
- If the zone is 2 or smaller, the fare is 7.25. If the zone is 3, the fare is 8.75.
- If the zone is greater than or equal to 4 and less than or equal to 6, the fare is 10.00.
- If the zone is greater than or equal to 7 and less than or equal to 8, the fare is 11.50.
- If the zone is 9, the fare is 13.50. If the zone is greater than or equal to 10,
the fare is 20.00.
- Write a program that asks a user to enter a list of clothing items purchased. Your program
should then calculate their total bill with tax. In New York City, the tax on clothing items
that priced $110 or less is 0%. The tax on clothing items priced more than $110 is 8.5%.
Here is a sample run of the program:
Please enter clothing prices, separated by commas: 100, 9.99, 200, 159.99
(The `T' indicates which items are taxed. To make the receipt look nice, you can use
format() and rjust() functions.
- Modify the decodeMessage.py program from Lab 5 which
encodes messages with lower case letters to one that can also encode messages with upper
case letters and numbers.
This program decodes a textual message
Each character is replaced with the character 2 places ahead in the alphabet.
The characters "'", ".", "(", ")", and " " are not decoded.
Please enter the message to decode: 250 Bedford Park Blvd W, 10468
The decoded message is: 472 Dgfhqtf Rctm Dnxf Y, 32680
(Hint: try the original program on the message above. What are the differences in the
encoded messages it produces and the output above? Remember that ord("a") is different from
- Write a graphics program that changes colors depending where the user clicks on the
window. If the user clicks on the left side, the window should turn green. If the
user clicks on the right side, the window should turn red. Your program should allow
the user to click 5 times before ending the program.
For more information on using Blackboard, see the first lab
- Two of the five submitted programs will be chosen at random for grading.
- Assignments must be submitted by midnight on the date due.
- Every program should begin with a comment that includes your name and a brief description.
- No credit will be given for a late assignment.
- Extra credit will be awarded for graded programs that are submitted early. If a graded
program is submitted more than 12 hours early (before Friday noon), 1 extra credit point will be awarded. For
graded programs submitted more than 24 hours early (Thursday or earlier), 2 extra credit points will be awarded.
- You MUST attach your program as a file, you may also cut and paste your program into the submission box.
- The name of the file that you submit should begin with your last name (for example: yourlastnamePS2_2.py).
Your file MUST have a file type of .py
- Your program should contain a function definition for main(), and it should invoke main() at the end of the
- While working on this assignment you have access to help in class (if your question might be
of general interest), at the Math Lab, during office hours, and using the discussion forum for this problem set on
Blackboard. Please take advantage of all of these resources.