Home > OS >  What is the error in my CS50P jar.py class exercise?
What is the error in my CS50P jar.py class exercise?

Time:12-21

The assignment is to create a class of "cookie jar" that can hold 0-12 cookies. Unfortunately I keep getting one error on the Check50, but I can't figure out why.

:( Jar's constructor raises ValueError when called with negative capacity
    expected exit code 0, not 1. Any hint would be greatly appreciated.
class Jar:
    def __init__(self, capacity=12):
        self.capacity = capacity
        self.size = 0

    def __str__(self):
        return '           
  • Related