4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

読書の進捗管理するスニペット

Last updated at Posted at 2017-11-01

ゼミ当日までにテクストを読むペースを計算するPythonの関数を作った.
読書家のみなさんのお役に立てたら嬉しい.

reading_plan.py
from datetime import date
import math

def reading_plan(title, total_number_of_pages, period):
    
    current_page = int(input("Current page?: "))
    deadline = (date(*period) - date.today()).days
    remaining_pages = total_number_of_pages - current_page
    
    print(title, period, "まで", math.ceil(remaining_pages / deadline) , "p/day 残り",
          remaining_pages, "p/", deadline, "days" )

例えば,『現象学の理念』という本で,ノルマが118ページ,2020年2月1日までに読む必要がある場合の引数の書き方.

reading_plan("『現象学の理念』", 118, (2020,2,1))

Current page?と聞かれるので現在のページ数を入力する

Current page?: 1
『現象学の理念』 (2020, 2, 1) まで 3 p/day 残り 117 p/ 57 days

すると,1日のノルマと,残りページ数と残り日数が計算される.
拙い技術力でコードを書いているので,より洗練された書き方等を教えていただけたら幸いです.
では,happy reading!! :books:

4
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
4
2

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?