Login and get coding
Happy New Year! How many books do you aim to read this year?
In this Bite you will complete
ontrack_readingthat takes the amount of books you want to read (
books_goal), the amount of books read (
books_read) and the day of the year (
Noneor not provided, it defaults to today, that is the offset in days into the year right now). The function returns a
boolsignifying 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) False >>> ontrack_reading(60, 0) # same as previous statement, today = 3rd of Jan False >>> ontrack_reading(60, 1, 3) True >>> ontrack_reading(10, 10, 365) True
Note: you need to
pip install freezegunif you want to run the tests locally.
111 out of 113 users completed this Bite.
Will you be Pythonista #112 to crack this Bite?
Resolution time: ~31 min. (avg. submissions of 5-240 min.)
Pythonistas rate this Bite 3.25 on a 1-10 difficulty scale.
» You can do it! 😌