Last active
April 16, 2020 00:14
-
-
Save bergpb/f2996f8233454281a3c896538c26a7e6 to your computer and use it in GitHub Desktop.
Sum months in python, justpython.
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 sys | |
| month = sys.argv[1] | |
| add = sys.argv[1] | |
| def add_month(month, add): | |
| next = month + add | |
| if next >= 13: | |
| return 1 if next-12 == 0 else next-12 | |
| return next | |
| # python sun-month.py 2 3 | |
| # >>> 5 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment