Commit 1dd4c228 authored by Adam Blank's avatar Adam Blank
Browse files

autocommit

parent 64cf0964
No related merge requests found
Showing with 40 additions and 0 deletions
+40 -0
from joke_types import Joke
from joke_library import get_n_jokes, rate_joke, tell_joke
def get_average_joke_rating(ratings: dict[int, int]):
return ...
def find_best_joke(jokes: dict[int, Joke], joke_ratings: dict[int, int]):
best_joke_id: int = -1
...
return jokes_by_id[best_joke_id]
def tell_jokes(n=3):
jokes = get_n_jokes(n)
# Make a dictionary of jokes keyed by id
jokes_by_id: dict[int, Joke] = {}
...
ratings: dict[int, int] = {}
# Tell each joke, going in reverse order, and rate and store user ratings
while len(jokes) > 0:
...
print()
return jokes_by_id, ratings
jokes_by_id, joke_ratings = tell_jokes()
print()
print("The average rating you gave was..." +
str(get_average_joke_rating(joke_ratings)))
print("The best joke was...")
tell_joke(find_best_joke(jokes_by_id, joke_ratings))
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