MCPcopy Create free account
hub / github.com/bslatkin/effectivepython / RatingInternal

Class RatingInternal

example_code/item_081.py:119–127  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

117
118print("Example 7")
119class RatingInternal:
120 def __init__(self, max_rating):
121 assert max_rating > 0, f"Invalid {max_rating=}"
122 self.max_rating = max_rating
123 self.ratings = []
124
125 def rate(self, rating):
126 assert 0 < rating <= self.max_rating, f"Invalid {rating=}"
127 self.ratings.append(rating)
128
129
130print("Example 8")

Callers 1

item_081.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected