Loading topic
date and timedelta from the datetime module and can read and write text files. The chapter itself needs little code. Its job is to settle what the tracker will record, because eve4 min readdate and timedelta types from the datetime module. It decides how the tracker stores its data. Every later calculation depends on that choice.3 min readdate type from the datetime module. You will write the function that records one check-in. Every later calculation reads the data this function produces, so it has to be correct.3 min readdatetime module's date and timedelta, and the check-in model from earlier chapters, where each habit maps to4 min readdatetime.date. The log from the earlier chapters is a dictionary that maps each habit name to a set of dates. I3 min readargparse usage. Here you connect those functions to two commands, check and show, so you can run the tracker from a terminal.2 min readcheck_in and current_streak functions from the earlier chapters. You should also be comfortable with date, timedelta and sets. The goal is to find the inputs that make those functions give a wrong or surprising answer, and to pin the correct behavior down wi3 min readcurrent_streak, longest_streak and completion_rate functions, and you should be comfortable with sets of dates and with timedelta. The code below uses those functions as they were defined before.3 min readcurrent_streak and completion_rate functions. It also assumes you are comfortable with date, timedelta and weekday().3 min read