Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
level3-lesson13-diy1
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
bba1bfda
authored
Mar 29, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
165dc3c6
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
0 deletions
test.py
test.py
0 → 100644
View file @
bba1bfda
#输入“年月日”,输出是一年中的第几天
## 输入年月日,判断是一年的多少天
def
getN
(
year
,
month
,
day
):
sum
=
0
## 到最后在判断是闰年还是平年
for
i
in
range
(
0
,
month
):
sum
+=
m
[
i
]
sum
+=
day
if
(
year
%
400
==
0
)
or
(
year
%
4
==
0
and
year
%
10
!=
0
):
## 表示是闰年
sum
+=
1
return
sum
year
=
input
(
"year : "
)
## 输出数据
month
=
input
(
"month : "
)
day
=
input
(
"day : "
)
m
=
[
0
,
31
,
28
,
31
,
30
,
31
,
30
,
31
,
31
,
30
,
31
,
30
]
## 只包括前 11 个月
year
=
int
(
year
)
month
=
int
(
month
)
day
=
int
(
day
)
print
(
getN
(
year
,
month
,
day
))
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment