Commit 5494f59c authored by Adam Blank's avatar Adam Blank
Browse files

autocommit

No related merge requests found
Showing with 5 additions and 7 deletions
+5 -7
...@@ -2,11 +2,11 @@ from joke_types import Joke ...@@ -2,11 +2,11 @@ from joke_types import Joke
from joke_library import get_n_jokes, rate_joke, tell_joke from joke_library import get_n_jokes, rate_joke, tell_joke
def get_average_joke_rating(ratings: dict[int, int]) -> float: def get_average_joke_rating(ratings: dict[int, int]):
... return ...
def find_best_joke(jokes: dict[int, Joke], joke_ratings: dict[int, int]) -> Joke | None: def find_best_joke(jokes: dict[int, Joke], joke_ratings: dict[int, int]):
best_joke_id: int = -1 best_joke_id: int = -1
... ...
...@@ -14,7 +14,7 @@ def find_best_joke(jokes: dict[int, Joke], joke_ratings: dict[int, int]) -> Joke ...@@ -14,7 +14,7 @@ def find_best_joke(jokes: dict[int, Joke], joke_ratings: dict[int, int]) -> Joke
return jokes_by_id[best_joke_id] return jokes_by_id[best_joke_id]
def tell_jokes(n: int = 3) -> tuple[dict[int, Joke], dict[int, int]]: def tell_jokes(n: int = 3):
jokes = get_n_jokes(n) jokes = get_n_jokes(n)
# Make a dictionary of jokes keyed by id # Make a dictionary of jokes keyed by id
...@@ -37,6 +37,4 @@ print() ...@@ -37,6 +37,4 @@ print()
print("The average rating you gave was..." + print("The average rating you gave was..." +
str(get_average_joke_rating(joke_ratings))) str(get_average_joke_rating(joke_ratings)))
print("The best joke was...") print("The best joke was...")
best_joke = find_best_joke(jokes_by_id, joke_ratings) tell_joke(find_best_joke(jokes_by_id, joke_ratings))
assert best_joke is not None
tell_joke(best_joke)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment