Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson9_3
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
f05092f3
authored
Nov 19, 2022
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
26c63e21
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
21 additions
and
6 deletions
1.py
diy3.py
1.py
0 → 100644
View file @
f05092f3
dice_list
=
{
"name"
:
"xiaoming"
,
"abc"
:
"xiaoli"
}
for
i
,
v
in
dice_list
.
items
():
print
(
i
)
print
(
type
(
i
))
diy3.py
View file @
f05092f3
...
@@ -24,13 +24,22 @@ for k,v in score.items():
...
@@ -24,13 +24,22 @@ for k,v in score.items():
# 查询并打印出输入的名字对应的所有科目的成绩
# 查询并打印出输入的名字对应的所有科目的成绩
while
True
:
#while True :
name
=
input
(
"名字:"
)
if
name
in
score
:
a
=
score
[
name
]
name
=
input
(
"名字:"
)
#输入查询的名字
if
name
in
score
:
#判断名字在不在字典里
a
=
score
[
name
]
#查询出名字所对应的成绩
print
(
'*'
*
30
)
print
(
'*'
*
30
)
for
k
,
v
in
a
.
items
():
for
k
,
v
in
a
.
items
():
#遍历各科成绩
print
(
k
,
v
)
print
(
k
,
v
)
#输出各科成绩
break
break
else
:
else
:
print
(
'输入错误'
)
print
(
'输入错误'
)
\ 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