Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson8-2
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
ef79b420
authored
Jul 11, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
4abb891e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
18 additions
and
0 deletions
diy.py
diy1.py
diy.py
View file @
ef79b420
dict
=
{
"张三"
:
55
,
"李四"
:
60
,
"王五"
:
70
}
dict
[
"李四"
]
=
80
dict
[
"赵六"
]
=
99
if
"赵六"
in
dict
:
print
(
dict
[
"赵六"
])
print
(
dict
)
\ No newline at end of file
diy1.py
0 → 100644
View file @
ef79b420
python1
=
{
"李"
:
98
,
"王"
:
99
,
"星"
:
100
,
"颜"
:
80
}
#创建班级字典,人名为键 语文成绩为值 李:98 王:99 星:100 颜:80 python1
python1
[
"颜"
]
=
100
#修改颜同学的语文成绩
print
(
python1
[
"颜"
])
#查看颜同学的语文成绩
if
"刘"
in
python1
:
#查看刘同学的成绩是否在班级中,如果在就输出所有人成绩,
print
(
python1
)
else
:
#如果不在就添加到班级中并且输出所有人成绩
python1
[
"刘"
]
=
100
print
(
python1
)
\ 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