Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson8-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
02db8da3
authored
Oct 29, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
98f24605
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
13 deletions
2.py
3.py
diy1.py
2.py
0 → 100644
View file @
02db8da3
dict
=
{
'888点券'
:
90
,
'ipad'
:
2000000000
,
'苹果'
:
40
,
'银行'
:
9000000000
,
'可口可乐'
:
45
,
'乐事'
:
9
,
'农失山泉'
:
2
,
'大白免'
:
1
,
'粤利粤'
:
6
,
'雷碧'
:
3
,
'喜之娘'
:
15
,
'啊萨姆'
:
4
}
k
=
input
(
'What would you buy?'
)
if
k
in
dict
:
print
(
'Good~your'
+
k
+
'must cost'
+
str
(
dict
[
k
])
+
'yuan~'
)
else
:
print
(
'Sorry,it is not in.Please waite some times~'
)
\ No newline at end of file
3.py
0 → 100644
View file @
02db8da3
cost
=
{
'apple'
:
3.14
,
'pear'
:
6.28
,
'peach'
:
9.42
,
'coke'
:
12.56
,
'fish'
:
15.7
,
'candy'
:
18.84
}
k
=
input
(
'Please print fruit name:'
)
v
=
input
(
'Please print fruit'
)
if
k
in
cost
:
if
float
(
v
)
<
cost
[
k
]:
cost
[
k
]
=
float
(
v
)
print
(
k
+
'jjl,xj'
+
v
+
'y'
)
else
:
print
(
k
+
'zzl,usnobuy'
)
else
:
cost
[
k
]
=
float
(
v
)
print
(
k
+
'djq'
+
v
+
'yysc'
)
\ No newline at end of file
diy1.py
View file @
02db8da3
# 这是悟空为花果山小猴做臂力测试的程序代码
dict_wc
=
{
'a'
:
9
,
'b'
:
25
,
'c'
:
15
,
'd'
:
45
,
'e'
:
12
}
name
=
input
(
'你叫啥名啊?'
)
print
(
dict_wc
)
power
=
int
(
input
(
'你臂力多少啊?'
))
print
(
dict_wc
[
'd'
])
list_hero
=
[
'猴三'
,
10
,
'猴一'
,
21
,
'猴五'
,
22
,
'猴队长'
,
29
,
'猴七'
,
30
]
dict_wc
[
'a'
]
=
250
for
i
in
range
(
len
(
list_hero
)):
print
(
dict_wc
)
if
i
%
2
==
1
and
list_hero
[
i
]
>=
power
:
dict_wc
[
's'
]
=
518
list_hero
.
insert
(
i
-
1
,
name
)
print
(
dict_wc
)
list_hero
.
insert
(
i
,
power
)
\ No newline at end of file
break
print
(
list_hero
)
# 请注释掉上面的代码,并在下一行创建一个名为dict_hero的字典
dict_hero
=
print
(
dict_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