CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutSign UpSign In
jackfrued

CoCalc provides the best real-time collaborative environment for Jupyter Notebooks, LaTeX documents, and SageMath, scalable from individual users to large groups and classes!

GitHub Repository: jackfrued/Python-100-Days
Path: blob/master/Day31-35/code/dayofyear.py
Views: 729
1
import sys
2
import mycal
3
4
5
def main():
6
if len(sys.argv) != 4:
7
print('Not enough arguments')
8
return
9
year = int(sys.argv[1])
10
month = int(sys.argv[2])
11
day = int(sys.argv[3])
12
total = 0
13
for m in range(1, month):
14
total += mycal.get_days(year, m)
15
total += day
16
print(f'{year}{month}{day}日是{year}年的第{total}天')
17
18
19
if __name__ == '__main__':
20
main()
21
22
23