Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson8-4
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
29ec9cd3
authored
Sep 04, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
682edbea
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
23 additions
and
21 deletions
diy.py
diy.py
View file @
29ec9cd3
...
...
@@ -5,18 +5,20 @@
# print('您好,您要买的'+k+"需要"+str(dict[k])+"元")
# else:
# print("不好意思,您要买的东西暂时没有了!")
# score = {"小明":70,"小王":80,"小张":90}
# k = input("请输入你的姓名:")
# v = input("请输入你的分数:")
# if k in score:
# if int(v)>score[k]:
# score[k]=int(v)
# print('亲爱的'+k+'同学你好,您的成绩刷新成功,已改为'+str(v)+"分")
# else:
# print("抱歉,"+k+"同学你的成绩未刷新成功,请再接再厉!")
# else:
# score[k]=int(v)
# print("在表单里面没有查询到你,已经在里面添加了你的第一次成绩,"+k+"同学你的第一次成绩为"+str(v)+"分")
score
=
{
"小明"
:
70
,
"小王"
:
80
,
"小张"
:
90
}
k
=
input
(
"请输入你的姓名:"
)
v
=
input
(
"请输入你的分数:"
)
if
k
in
score
:
if
int
(
v
)
>
score
[
k
]:
score
[
k
]
=
int
(
v
)
print
(
'亲爱的'
+
k
+
'同学你好,您的成绩刷新成功,已改为'
+
str
(
v
)
+
"分"
)
print
(
score
)
else
:
print
(
"抱歉,"
+
k
+
"同学你的成绩未刷新成功,请再接再厉!"
)
else
:
score
[
k
]
=
int
(
v
)
print
(
"在表单里面没有查询到你,已经在里面添加了你的第一次成绩,"
+
k
+
"同学你的第一次成绩为"
+
str
(
v
)
+
"分"
)
print
(
score
)
# score = {'小明':70,'小王':60,'小周':90}
# k = input("请输入你的姓名:")
# v = input("请输入你的分数:")
...
...
@@ -30,13 +32,13 @@
# score[k]=int(v)
# print("亲爱的"+k+"同学不好意思,里面没有查询到你的信息,已将你的分数写为"+str(v)+"分")
# print(score)
name
=
input
(
"请输入你的名字"
)
power
=
int
(
input
(
"请输入你的臂力值"
))
list_hero
=
[
'猴三'
,
10
,
'猴一'
,
21
,
'猴五'
,
30
,
'猴七'
,
32
]
for
i
in
range
(
len
(
list_hero
)):
if
i
%
2
==
1
and
list_hero
[
i
]
>=
power
:
list_hero
.
insert
(
i
-
1
,
name
)
list_hero
.
insert
(
i
,
power
)
break
print
(
list_hero
)
#
name = input("请输入你的名字")
#
power = int(input("请输入你的臂力值"))
#
list_hero = ['猴三',10,'猴一',21,'猴五',30,'猴七',32]
#
for i in range(len(list_hero)):
#
if i % 2 == 1 and list_hero[i]>=power:
#
list_hero.insert(i-1,name)
#
list_hero.insert(i,power)
#
break
#
print(list_hero)
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