CS 303e, Assignment #10: Practice Reading and Fixing Code Due: Sunday, April 14, 2019 Points: 20
CS 303e, Assignment #10: Practice Reading and Fixing Code Due: Sunday, April 14, 2019 Points: 20
Points: 20
Purpose: The purpose of this project is for you to become familiar with reading and
understanding what code is doing. In this assignment you will be practicing: reading code,
Classes, functions, looping, conditionals, if statements, and lists.
Learning Objectives: By the end of this assignment you should be able to:
- Read and execute code written by others to determine the code functionality
- Understand why selecting good names for identifiers, functions, and classes is important
The Assignment:
We have provided a python file that contains code that will run but contains no
comments and is written in a very unorganized way, badly named, and coded oddly.
1. Overall, what does this program do? Write 4 sentences describing the overall program.
Basically, you are looking at the entire program as a whole.
2. Overall, what does class c2 represent? Write 4 sentences describing the overall class.
Basically, you are looking at the class c2 as a whole.
3. What does function10 do? Write 2-3 sentences describing this function.
4. What does function3_ do? Write 2-3 sentences describing this function.
5. What is aList being used to store? Write 1-2 sentences describing what this stores.
6. What is nums being used to store? Write 1-2 sentences describing what this stores.
7. What is the format of the input into the program? What does the format represent?
9. What functions (or methods) are not needed AND do not serve a purpose to the over-all
program? (Recall: methods are functions inside the class)
10.What is wrong with function3? Write 2 to 3 sentences describing what is wrong with the
code.
11. What is the purpose of the method set_C1? Write 2-3 sentences explain this method.
12.What is the purpose of each of the other methods in class c2? Write 1-2 sentences for each
method. (You may exclude set_C1 discussed in the previous question)
13.Why are the identifiers used in this program so problematic? Write 2-3 sentences
explaining/justifying your answer.
Instructions:
Download the supplied py file. Open in Python. Look for the input statement(s) within the code
to figure the input format for the program. Try various inputs and observer the output.
Fix the code by renaming variables, functions, and classes, removing anything unneeded (and
could not serve a useful purpose), fix any weird spacing issues, short lines of code or rewrite
code to look more “normal”. Answer the questions above as comments in your code above
your version of the cleaned-up code.
Submission Instructions:
• In order to receive full credit, you must submit a .py file to Canvas (otherwise your
assignment cannot be graded and will result in a 0)
• Your answers to the questions must be comments above your code. (Otherwise your
assignment will receive a 0)
• If your assignment is late, the penalty is 5% per day. (This includes weekends, holidays, etc.).
• Make sure you submit the correct file (submitting the incorrect file results in a 0)
The Auto-Grader:
• Yes, a computer program will be grading your program! We will be using the Python
3 standard. (Please note: there are some differences between 2 and 3 - make sure
you have Python 3)
• We will be running your code to make sure it still functions in the same way as the
original.
• When your output does not match exactly, you will temporarily be assigned a grade
of 0
• Your assignment will be hand checked by the graders and your will earn partial
credit (see rubric below)
• Please do not email us regarding your grade until after we announce (via
Canvas) finalized grades have be posted!
• If we have announced grades have been finalized and you still have a zero or
other questions regarding your score, please see or contact the TA who
posted the grades to discuss your grade (check Piazza for the
announcements)
• As stated in the syllabus: You have one week from when grades have been
posted to contest the grade
Program identifiers are useful and describe the variable, class, function: 5 points