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
e66762af
authored
Sep 03, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
8ca8f097
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
42 additions
and
7 deletions
diy.py
diy.py
View file @
e66762af
# 神奇百货中的物品已经帮你创建好啦,接下来要看你的了~
dict
=
{
'可口可乐'
:
3
,
'旺仔牛奶'
:
4
,
'农夫山泉'
:
1
,
'辣条'
:
3
,
'巴西烤肉'
:
2
,
'果冻'
:
4
,
'乐事'
:
5
,
'奥利奥'
:
10
,
'巧克力'
:
6
}
k
=
input
(
"想要买什么?"
)
if
k
in
dict
:
print
(
'您好,您要买的'
+
k
+
"需要"
+
str
(
dict
[
k
])
+
"元"
)
else
:
print
(
"不好意思,您要买的东西暂时没有了!"
)
#神奇百货中的物品已经帮你创建好啦,接下来要看你的了~
# dict= {'可口可乐':3,'旺仔牛奶':4,'农夫山泉':1,'辣条':3,'巴西烤肉':2,'果冻':4,'乐事':5,'奥利奥':10,'巧克力':6}
# k=input("想要买什么?")
# if k in dict:
# 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,'小王':60,'小周':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)+"分")
# 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
)
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