Last active
March 11, 2020 21:47
-
-
Save prithajnath/48896d5d49c0e4769ad6d487f99d5ce4 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import math | |
import sys | |
from datetime import datetime | |
cases_til_date = int(sys.stdin.read()) | |
first_us_case_date = datetime.strptime("01-19-20", "%m-%d-%y") | |
today = datetime.now() | |
# Using 2 as base | |
num_of_doubled = math.log(cases_til_date, 2) | |
doubling_rate = num_of_doubled/(today - first_us_case_date).days | |
projected_date = datetime.strptime("05-09-20", "%m-%d-%y") | |
projected_cases = 2**(doubling_rate*(projected_date - first_us_case_date).days) | |
print(f"{projected_cases:,}") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment