avatar Bite 322. Reading progress

Happy New Year! How many books do you aim to read this year?

In this Bite you will complete ontrack_reading that takes the amount of books you want to read (books_goal), the amount of books read (books_read) and the day of the year (day_of_year, if None or not provided, it defaults to today, that is the offset in days into the year right now). The function returns a bool signifying if you are on track or not.

Here is how it works in the REPL:

>>> from progress import ontrack_reading
>>> ontrack_reading(60, 0, 3)
>>> ontrack_reading(60, 0)  # same as previous statement, today = 3rd of Jan
>>> ontrack_reading(60, 1, 3)
>>> ontrack_reading(10, 10, 365)

Note: you need to pip install freezegun if you want to run the tests locally.

Login and get coding
go back Beginner level
Bitecoin 2X

116 out of 118 users completed this Bite.
Will you be Pythonista #117 to crack this Bite?
Resolution time: ~30 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 3.25 on a 1-10 difficulty scale.
» You can do it! 😌

Focus on this Bite hiding sidebars, turn on Focus Mode.

Ask for Help