CS303E Programming Assignments

Program
Number
Points Due Date
All Programs
Due at 11 pm
Topics
1 10 Monday 6/10 learning how to use the course software, simple output
2 10 Thursday 6/13 variables, expressions, output
3 10 Monday 6/17 user input, expressions, and variables
4 10 Thursday 6/20 conditional execution
5 10 Thursday 6/27 more conditional execution
6 20 Monday 7/1 iteration - loops and simulating the dice game of craps
7 20 Monday 7/8 functions - Rock, Paper, Scissors Game
8 20 Thursday 7/11 files - Counting wins by a sports team
9 20 Monday 7/15 lists - Racko
10 20 Thursday 7/18 lists and files, movie sentiment
11 20 Monday 7/22 lists of lists, pgm image file format
12 20 Thursday 7/25 dictionaries, first digit from values in large data sets
13 20 Monday 7/29 creating classes, using objects


CS303E: Programming Assignment Requirements:

Assignments will typically consist of a single Python file. The assignment descriptions shall specify which files to submitt and how they shall be named.

Assignments that are not in the correct format or are not named correctly shall lose all correctness points.

Assignments must be turned in via GradeScope to the correct GradeScope  assignment. Assignments that are not turned into the correct GradeScope assignment shall receive a grade of zero.

Programs shall be run with an auto-graer via GradeScope on Canvas using Python version 3.8. Programs that do not compile shall lose all correctness points. Programs that suffer runtime errors may lose significant correctness points. Your program output must match the expected output to the character.

Each program must contain the following header with your information filled it. Programs that do not contain the header with your information shall lose 10% of the assignment points. You must replace any of the items such as <YOUR NAME> with the proper information. Delete the "<" and ">".

# File: <NAME OF FILE>
# Description: <A DESCRIPTION OF YOUR PROGRAM>
# Assignment Number: <Assignment Number, 1 - 13>
#
# Name: <YOUR NAME>
# EID:  <YOUR EID>
# Email: <YOUR EMAIL>
# Grader: <YOUR GRADER'S NAME Mayra or Risha>
#
# On my honor, <YOUR NAME>, this programming assignment is my own work
# and I have not provided this code to any other student.


Copy and paste the above header into your program and fill in the necessary information. Do this for every program you turn in. Replace the items in the brackets, <>, with the correct information for you. For example:

# File: initials.py
# Description: Print out my initials.
# Assignment Number: 1
#
# Name: Mike Scott
# EID:  mds98123
# Email: scottm@cs.utexas.edu
# Grader: Mayra
#
# On my honor, Michael Scott, this programming assignment is my own work
# and I have not provided this code to any other student.

You have 8 slip/late days (i.e., 1 minute to 24 hours late = 1 slip day, etc.) for the assignments. No more than 1 slip day may be used per any given assignment.


Rationale:

"The cleaner and nicer the program, the faster it's going to run. And if it doesn't, it'll be easy to make it fast." - Joshua Bloch

"Code is read more often than it is written. Code should always be written in a way that promotes readability." - Guido van Rossum (creator of Python)

"It's a long-standing principle of programming style that the functional elements of a program should not be too large. If some component of a program grows beyond the stage where it's readily comprehensible, it becomes a mass of complexity which conceals errors as easily as a big city conceals fugitives. Such software will be hard to read, hard to test, and hard to debug." - Paul Graham

Program are graded based on correctness, design, clarity, and efficiency. As the official Python Style Guide states: "Code is read much more often than it is written." and "Readability counts." The typical breakdown is 12 points for correctness and 8 points for program hygiene.

Following the program hygiene (style, best practices) relevant to out programs as outlined in PEP (Python Enhancement Proposal) 8.

Highlights relevant to 303e:

  1. two blank lines before and after functions
  2. four spaces per indent level (this is the default in IDLE and PyCharm)
  3. Use spaces not tabs for indenting whitespace
  4. limit lines [of code] to 79 characters (break lines if necessary)
  5. "For flowing long blocks of text with fewer structural restrictions (docstrings or comments), the line length should be limited to 72 characters."
  6. "Use blank lines in functions, sparingly, to indicate logical sections." If a logical section is long, it should be its own function
  7. "Always surround these binary operators with a single space on either side: assignment (=), augmented assignment (+=, -= etc.), comparisons (==, <, >, !=, <>, <=, >=, in, not in, is, is not), Booleans (and, or, not)." For 303e we always add a space before an after binary operators including +, -, *, /, //, %, =. The one exception is when using the = operator for keyword arguments such as sep="--" in the function call print('Alice', 'Bob', 'Chuck', sep='--')
  8. "Never use the characters 'l' (lowercase letter 'el'), 'O' (uppercase letter 'oh'), or 'I' (uppercase letter 'eye') as single character variable names."
  9. Function names shall be lowercase, with words separated by underscores as necessary to improve readability. Variable names follow the same convention as function names. So, pay_rate or time_of_day. For 303e we you shall make your identifiers meaningful. The identifier shall help explain the purpose of the variable or function.

  10.  For 303e we shall always have a main function and all code shall be part of some function except the call to the main function.

In addition to these requirements we add the following:

1. Limit the scope of a variables to the smallest necessary. In other words don't declare variables until you need them. This also means you shall not use global variables on programming assignments.

2. Choose descriptive, but concise variable names. birth_year instead of b (too short) or birth_year_entered_by_the_user_of_this_program (too long).

Programming assignments will be graded by class staff within five days of the due date. Your program grade will be posted to Canvas with feedback. Your grade is NOT the starting point of negotiations with your TA. Consider your TA your manager at software development job. Use their feedback to improve on the NEXT program.

When grading for correctness your program's output shall be compared to the expected output based on the same inputs. We have a perfect test where the output must match exactly and a close test where some number of lines are allowed to have differences. Note, output is compared on a per line basis. Any differences in a line be it spacing, capitalization, differences in punctuation, or even extra spaces at the end of a line, will result in that line being flagged as incorrect. Your output must match the given example outputs exactly. I recommend using a diff tool which can be found on websites such as https://text-compare.com/. Alternatively many IDEs provide a diff tool or you can download an app for your machine. Note, when comparing expected out to actual output, we will ignore blank lines. However, if an assignment specification calls for blank lines, you are still to include them, but our tester will simply ignore them.


Note about cheating on programming assignments: While most of you reading this would never consider cheating, it is important for your instructors to detect cheating and carry out penalties in order for you to be graded fairly in your classes. As discussed in the class syllabus, programming assignments will be checked for plagiarism and copying using MOSS (Measure of Software Similarity). Keep in mind that MOSS is impervious to common ways of disguising code copying. It ignores differences in variable and method names, re-arrangement of code, shuffling blocks (like conditional blocks, for example), changes in spacing and comments. I suggest an experiment: get a MOSS account (http://theory.stanford.edu/~aiken/moss/), take one of your class projects, and do everything you can to modify it so that it looks different from the original to anyone who might read it. Then submit both programs to MOSS. It will detect that they are the same.

Sharing code or algorithms with another student or obtaining assignment solutions from any source (especially from the web or an LLM such as chatGPT) is cheating. The penalty for cheating is an F in the course and a referral to the Dean of Students office.

More on Academic Honesty: Taken from the CS department Code of Conduct.

"The University and the Department are committed to preserving the reputation of your degree. It means a lot to you. In order to guarantee that every degree means what it says it means, we must enforce a strict policy that guarantees that the work that you turn in is your own and that the grades you receive measure your personal achievements in your classes:

Every piece of work that you turn in with your name on it must be yours and yours alone unless explicitly allowed by an instructor in a particular class. Specifically, unless otherwise authorized by an instructor:

You are responsible for complying with this policy in two ways:

  1. You must not turn in work that is not yours, except as expressly permitted by the instructor of each course.
  2. You must not enable someone else to turn in work that is not theirs. Do not share your work with anyone else. Make sure that you adequately protect all your files. Even after you have finished a class, do not share your work or published answers with the students who come after you. They need to do their work on their own.

The penalty for academic dishonesty will be a course grade of F and a referral of the case to the Dean of Students. Further penalties, including suspension or expulsion from the university may be imposed by that office.

One final word: This policy is not intended to discourage students from learning from each other, nor is it unmindful of the fact that most significant work in computer science and in the computing industry is done by teams of people working together. But, because of our need to assign individual grades, we are forced to impose an otherwise artificial requirement for individual work. In some classes, it is possible to allow and even encourage collaboration in ways that do not interfere with the instructor's ability to assign grades. In these cases, your instructor will make clear to you exactly what kinds of collaboration are allowed for that class."

For CS303e the policy on collaboration is modified as follows:

You are encouraged to study for tests together, to discuss at a very high level methods for solving the assignments, to help each other in using the software, and to discuss methods for debugging code.

You are committing academic dishonesty if you look at someone else code (current students, past students and code from the web) in electronic or discuss the code in at such a detailed level that solutions turn out essentially the same. You are committing academic dishonesty if use use a large language model / generative AU such as chatGPT to generate any of your code. You shall not ask anyone to give you a copy of their code or, conversely, give your code to another student who asks you for it.

Similarly, you shall not discuss your algorithmic strategies at such a detailed level that you and your collaborators end up turning in essentially the same code. Discuss very high level approaches together, but do the coding on your own. Realize with complex problems, two programs that have produce the same results given the same input will vary significantly in approach and structure. You are making many, hundreds, of micro decisions as you design and implement your programs. It is extraordinarily unlikely two people working on the same complex problem will produce the same solution.

Examples of cheating are many and include accessing another student's account, using a large language model / generative AI such as chatGPT to generate any of the code you tur in, looking at someone else's solution code, copying or downloading someone else's solution code on the web or other sources, referring to solutions from previous semesters, having another student walk you through the solution and how to code it, discussing the problem at such a detailed that you are essentially coding together, having another student perform significant debugging of your code, having another student write your code for you and / or allowing others to copy of access your solution code.  This means you shall not look on the internet or use an LLM such as chatGPT for code to solve your problems. This list is not all inclusive.

Examples of allowable collaboration include discussions and debate of general concepts and solution strategies and help with syntax errors.

You can reuse code from lecture, help hours, and the class textbook with proper credit given. Use a comment to note code and the source (lecture, help hours, or class textbook).

If you have any doubts about what is allowed ask the instructor.

Plagiarism detection software will be used on assignments to find students who have copied code from one another and / or the web. 

For more information on Scholastic Dishonesty see the University Policy on Scholastic Dishonesty