Last active
December 26, 2015 23:14
-
-
Save TheFrostlixen/52262fd8415b85fbc1b7 to your computer and use it in GitHub Desktop.
Figures out the length of time between two arbitrary days
This file contains 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 | |
def daysInMonth(x): | |
return 28 + (x + math.floor(x/8)) % 2 + 2 % x + 2 * math.floor(1/x) | |
month = int(raw_input("month: ")) | |
day = int(raw_input("day: ")) | |
dmonth = int(raw_input("to (month): ")) | |
dday = int(raw_input("to (day): ")) | |
if dmonth > month: | |
dmonth += 12 | |
sumDays = dday - day | |
for x in range(month, dmonth): | |
sumDays += daysInMonth(x) | |
print str(int(sumDays/7)) + " weeks " + str(int(sumDays%7)) + " days" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment