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
e5d2e9da
authored
Nov 19, 2021
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
502609b5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
34 additions
and
0 deletions
2.py
3.py
diy1.py
quiz.py
2.py
0 → 100644
View file @
e5d2e9da
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 @
e5d2e9da
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
0 → 100644
View file @
e5d2e9da
dict_wc
=
{
'a'
:
9
,
'b'
:
25
,
'c'
:
15
,
'd'
:
45
,
'e'
:
12
}
print
(
dict_wc
)
print
(
dict_wc
[
'd'
])
dict_wc
[
'a'
]
=
250
print
(
dict_wc
)
dict_wc
[
's'
]
=
518
print
(
dict_wc
)
\ No newline at end of file
quiz.py
0 → 100644
View file @
e5d2e9da
# 直接运行以下代码,说说你的发现:
list_hero
=
[
'赵一'
,
30
,
'丁二'
,
37
,
'孙五'
,
52
,
'王猛'
,
89
,
'周亮'
,
98
]
dict_hero
=
{
'赵一'
:
30
,
'丁二'
:
37
,
'孙五'
:
52
,
'王猛'
:
89
,
'周亮'
:
98
}
print
(
len
(
list_hero
))
print
(
len
(
dict_hero
))
\ 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