Python programing | Computer Science homework help

Assignment 5

Submit Assignment

  • Due Dec 11 by 11:59pm
  • Points 110
  • Submitting a file upload
  • File Types py
  • Available Nov 21 at 12am – Dec 11 at 11:59pm 21 days

Programming Assignment #5: Graph Solution to the Water Container Problem

What is the assignment?

  • To implement a function that uses a graph-search approach to produce a “path” that represents a solution to the water container problem.
  • See the following wikipedia page for more information about this problem, which dates back much further than the Die-Hard movie that it appears in 😉

What to hand in?

  • One (and only one) *.py file should be handed in. All your checks, unit tests should be inside of this file.
  • The name of the function in your program should be findWaterContainerPath, and it should except three integer arguments. 
  • Note that your program should be able to run at the console/terminal (e.g. $ python If it does not, then the execution portion of the assignment will be 0. 

What needs to be done?

  • Ultimately, all that needs to be done is to have a function, named findWaterContainerPath, return a list of states that represents a solution to the water container problem. 
  • Note that each state can be thought of a vertex on a graph, and the transitions between the states can be thought of as the edges. 
  • To successfully implement the function you will need to figure out what all of the possible state transitions (i.e. edges). You’ll then perform a BFS across all of these states; adding a state to your final solution path when it is used (and being sure to not add, or to remove, states that are not on the solution path).

Be careful… 

  • As with all assignments, do not copy code from the internet, and do not share/copy code directly from others. There are lots of poor implementations of this problem online, so even if you look at some to better understand the problem, be sure that you implement your own so that you can be confident that you understand what each step is doing. 
  • Remember, copying/sharing code is a violation of the Student Code of Conduct. If you are found to have been doing this, then the grade for this assignment may be a zero, and a report with the Dean of Students may be filed. 

Getting Started

  • Use the following code to get started if you like. If, however, you decide not to, be sure that you still name your function “findWaterContainerPath”, and that it accepts the three given arguments. 
import math
import unittest

def findWaterContainerPath(a, b, c):
    starting_state = (0, 0)
    final_path = list()


    return final_path


class TestWaterContainerGraphSearch(unittest.TestCase):

    def testFindWaterContainerPath(self):


def main():
    capacity_a = input("Enter the capacity of container A: ")
    capacity_b = input("Enter the capacity of container B: ")
    goal_amount = input("Enter the goal quantity: ")


    if int(goal_amount) % math.gcd(int(capacity_a), int(capacity_b)) == 0:
        path = findWaterContainerPath(int(capacity_a), int(capacity_b), int(goal_amount))
        print("No solution for containers with these sizes and with this final goal amount")


# unittest_main() - run all of TestWaterContainerGraphSearch's methods (i.e. test cases)
def unittest_main():

# evaluates to true if run as standalone program
if __name__ == '__main__':

Good luck!


Assignment 5 RubricAssignment 5 RubricCriteriaRatingsPtsThis criterion is linked to a Learning OutcomeProgram Execution and Output30.0 to >25.0 ptsGoodProgram executes with no syntax or runtime errors and produces nearly all of the appropriate output when run through the test script (26pts – 30pts).25.0 to >10.0 ptsFairProgram executes with via the test script but does not produce all of the desired/correct output (11pts – 25pts).10.0 to >0 ptsPoorProgram does not execute via the test script without some modification and/or produces none or very little of the desired output in the test script (0pts – 10 pts).30.0 pts
This criterion is linked to a Learning OutcomeCode Logic and Design40.0 to >30.0 ptsGoodProgram has all required classes, variables, and methods defined (31pts – 40pts).30.0 to >10.0 ptsFairProgram has at least some but not all requisite classes, methods, or variables (11pts – 30pts).10.0 to >0 ptsPoorProgram has few or none of the classes, variables, or methods that were required (0pts – 10pts).40.0 pts
This criterion is linked to a Learning OutcomeCoding Standards and Documentation30.0 to >20.0 ptsGoodProgram has documentation for each class, method, function and this is displayed when using Python’s help function, “help()”. Documentation should clearly explain how and why methods are implemented as is (e.g. when and how does HashTable choose to resize itself). In addition to this, for full points the code should be consistently formatted, with consistency in how methods and variables are named (21pts – 30pts).20.0 to >10.0 ptsFairProgram has some documentation and is somewhat consistent in formatting, variable/method naming, etc. However, at least one of those is missing/incorrect (11pts – 20pts).10.0 to >0 ptsPoorProgram has little to no documentation, is not structured/formatted well, and does follow a consistent approach towards naming variables/method (0pts – 5pts).30.0 pts
This criterion is linked to a Learning OutcomeTesting10.0 to >5.0 ptsGoodProgram tests edge cases, or scenarios that would produce unexpected results using Python’s unittest (4pts – 5pts).5.0 to >2.0 ptsFairProgram tests for some edge cases but is missing important/obvious edge cases and may not be using unittest (3pts – 4pts).2.0 to >0 ptsPoorProgram has very few or no checks for edge cases, and does not make use of unittest (0pts – 2pts).10.0 pts
Total Points: 110.0PreviousNext

Calculate your paper price
Pages (550 words)
Approximate price: -

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

Calculate the price of your order

Total price:

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.


Essay Writing Service

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.


Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.


Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.


Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.