Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson4_1
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
652e18ea
authored
Sep 25, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
370cf254
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
6 deletions
diy1.py
test0724.py
diy1.py
View file @
652e18ea
username
=
"python"
# 保存在服务器数据库中的用户账号(正确的账号)
"""
userpassword
=
"123456"
# 保存在服务器数据库中的用户密码(正确的密码)
输入某年某月某日,判断这一天是这年的第几天
eg:以3月5日为例,前面有两个月要加起来,然后再加上5,
特殊情况,需要判断闰年,闰年2月多一天
闰年判断: 整百年能被400整除,非整百年能被4整除,不能被100整除。
"""
year
=
int
(
input
(
"请输入年份:"
))
month
=
int
(
input
(
"请输入月份:"
))
day
=
int
(
input
(
"请输入日:"
))
# 请用input()实现用户输入账号、密码的功能
months
=
[
0
,
31
,
59
,
90
,
120
,
151
,
181
,
212
,
243
,
273
,
304
,
334
]
print
(
"您输入的是
%
d年
%
d月
%
d日"
%
(
year
,
month
,
day
))
if
(
(
year
%
400
)
==
0
or
((
year
%
4
)
==
0
and
(
year
%
100
)
!=
0
)):
# 如果用户输入的账号、密码正确,提示登陆成功
print
(
"是闰年"
)
\ No newline at end of file
rday
=
1
else
:
print
(
"不是闰年"
)
rday
=
0
sumday
=
months
[
month
-
1
]
+
day
+
rday
print
(
"是第
%
d天"
%
sumday
)
\ No newline at end of file
test0724.py
0 → 100644
View file @
652e18ea
print
(
"123"
,
"456"
,
"789"
,
"abc"
,
end
=
"
\t
"
)
print
(
"123"
,
"456"
,
"789"
,
"abc"
,
sep
=
','
)
print
(
"123"
,
"456"
,
"789"
,
"abc"
,
sep
=
'Hi'
)
\ No newline at end of file
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