Skip to content

Instantly share code, notes, and snippets.

@prithajnath
Last active March 11, 2020 21:47
Show Gist options
  • Save prithajnath/48896d5d49c0e4769ad6d487f99d5ce4 to your computer and use it in GitHub Desktop.
Save prithajnath/48896d5d49c0e4769ad6d487f99d5ce4 to your computer and use it in GitHub Desktop.
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