# Representation of a price in integer dollars and cents.
class Price:
# Initialize a new Price object.
# input: dollars as an integer
# input: cents as an integer
def __init__(self, dollars: int, cents: int):
self.dollars = dollars
self.cents = cents
# Provide a developer-friendly string representation of the object.
# input: Price for which a string representation is desired.
# output: string representation
def __repr__(self) -> str:
return 'Price({}, {})'.format(*args: self.dollars, self.cents)
# Compare the Price object with another value to determine equality.
# input: Price against which to compare
# input: Another value to compare to the Price
# output: boolean indicating equality
def __eq__(self, other) -> bool:
return (other is self or
type(other) == Price and
self.dollars == other.dollars and
self.cents == other.cents)