Created
November 30, 2019 23:13
-
-
Save vskrachkov/7e1b5751fbe6ed572568637b8409b53f to your computer and use it in GitHub Desktop.
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
def to_minutes(wd, h, m): | |
return wd * 24 * 60 + h * 60 + m | |
def from_minutes(minutes): | |
wd = minutes // (24 * 60) | |
rest = minutes - (wd * 24 * 60) | |
return wd, rest // 60, rest % 60 | |
if __name__ == '__main__': | |
print(f'from_minutes(to_minutes(2, 23, 45)) -> {from_minutes(to_minutes(2, 23, 45))}') | |
print(f'from_minutes(to_minutes(2, 21, 45)) -> {from_minutes(to_minutes(2, 21, 45))}') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment