Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/bslatkin/effectivepython
/ rate
Method
rate
example_code/item_081.py:101–104 ·
view source on GitHub ↗
(self, rating)
Source
from the content-addressed store, hash-verified
99
self.ratings = []
100
101
def
rate(self, rating):
102
if
not (0 < rating <= self.max_rating):
103
raise
RatingError(
"Invalid rating"
)
104
self.ratings.append(rating)
105
106
107
print(
"Example 6"
)
Callers
1
item_081.py
File · 0.45
Calls
2
RatingError
Class · 0.85
append
Method · 0.45
Tested by
no test coverage detected