This is a group assignment. Remember that you should always be working with your partner. You may NOT divide up the work and complete the parts independently. All work you submit must be fully authored by both you and your partner.
Part 1: Code of Conduct
Much of this course is filled with activities and assignments that you must complete with a partner, and history has shown that it is useful to have a Code of Conduct that is tailored to our class. The goal of such a code of conduct is to ensure that these partnerships are effective and help cultivate a friendly environment that facilitates the learning in this course.
Your task for this problem is to write a one page code of conduct proposal that you think would be a good policy to adopt for our class. The key elements and themes from everyone’s submissions will then be combined into a single Code of Conduct policy for our course.
Warning! Parts of your proposal may be shared with the class and discussed in a large group, so be prepared to defend your proposal to your classmates.
You should begin by discussing your takeaways from Stuart Wray’s How Pair Programming Really Works article
Your proposal must address all of the following.
In his article, Wray primarily discusses pair programming in which two people sit at one computer and each have different roles. Here is what he writes (emphasis mine):
In this metaphor, the driver controls the keyboard and focuses on the immediate task of coding, and the navigator acts as a reviewer, observing and thinking about more strategic architectural issues.
Your proposal should address whether our class should adopt this method of pair programming and provide rationale for your recommendation.
If you argue that we should use the driver/navigator method, your recommendation should at least answer the following questions:
- What are the primary responsibilities of the driver?
- What are the primary responsibilities of the navigator?
- What guidelines do you suggest that would make the driver/navigator method as effective as possible?
If you argue that we should NOT use the driver/navigator method, you must provide an alternative approach to working in a pair. Just as working on a team in industry will be unavoidable, you may not recommend that we drop the group work in this course. Your recommendation must also adhere to our Academic Integrity Policy.
General Behavioral Guidelines
Your proposal should also include suggestions for general behavioral guidelines to make working in a group successful. For example, you may specify guidelines that are related to communication, meetings, and mutual respect.
Consequences for Violations
Finally, your code of conduct should describe what consequences the instructor should apply to students who violate the guidelines in your proposal. Here are a few scenarios to help guide you through this process.
- Scenario 1
- A student doesn’t show up to meetings, or comes to meetings unprepared, or ignores their partner during meetings and expects their partner to complete the work and explain it to them.
- Scenario 2
- A student is disrespectful, doesn’t want to work with their partner, completes the assignment independently, and submits the assignment as if they completed it as a team.
Please put your proposal in a plain text file named
code_of_conduct.txt or a PDF document named
Part 2: Python Programming
Problem 1: Whatzitdo?
Sometimes programmers write programs that are difficult to read. Let’s take a look at the following program.
# Author: # Titus Klinge def main(): print("This program does something.") apple = input() orange = input() banana = input() salad = (int(apple) + int(banana) + 2*int(orange)) salad = salad - min(int(apple),int(orange),int(banana)) salad = salad - int(orange) salad = salad - max(int(apple),int(orange),int(banana)) print(salad) main()
a. Create a new file
mystery_solved.py and copy the code into it.
b. Add yourselves as authors to the program at the top.
c. Determine what the program is doing and modify the first
d. The variable names
salad aren’t very helpful. Give them names that are more descriptive of what they are.
e. Change the program so that it prints a helpful message to the user about what the program is doing before it prompts them to type in the three inputs.
f. Notice that the
int() function is being called an excessive number of times. Modify the code so that it only calls
int() three times.
g. Think again about what the program is doing. Are there any unnecessary steps in the computation of the output? If so, remove them.
Problem 2: Voting Year
Write a Python program in a file named
voter.py that asks the user what year they were born and then prints the first U.S. presidential election year that they can vote in. This is a bit trickier since the user needs to be at least 18 to vote and presidential elections only happen on years that are divisible by four. (For simplicity, you may assume that the user of your program was born before November.)
What year were you born? 2000 You can vote in the 2020 presidential election.
For this problem, you are not allowed to use conditionals or loops to solve this problem! Below demonstrates a trick idea that allows you to compute the decade someone was born in. You will need to do something similar in your
import math birth_year = 1996 decade = math.floor(birth_year / 10) print("You were born in the " + str(decade) + "0s.")
How to Turn in Your Code
- Once you are finished with the assignment, you should go to https://codepost.io and log into your account.
- Go to the CS 65 course.
- Go to Assignment 3 and upload all of your files.
- After you submit the assignment, you should be able to reopen it and see a Partners tab at the top of the submission page. Send the link to your partner and have them open it while logged in with their account.
- That’s it! You’ve just submitted your assignment.
Important Grading Criteria
I will evaluate your work with the following criteria in mind.
- Correctness. Does your code do what is asked? (e.g. named correctly, input and outputs correct values, etc.)
- Formatting. Is your code formatted so that it is easy to understand?
- Elegance. Is your code concise and elegant?