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
a43ffe33
authored
3 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
97a0b2bc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
1.py
quiz.py
1.py
View file @
a43ffe33
#a=input("你叫什么")
#s=int(input("你的臂力多少"))
#
list_hero=["1",10,'2',21,'3',23,'4',29,'7',30]
#
for i in range(len(list_hero)):
#
if i%2==1 and list_hero[i]>=s:
#
list_hero.insert(i-1,a)
#
list_hero.insert(i,s)
#
break
#
print(list_hero)
list_hero
=
[
"1"
,
10
,
'2'
,
21
,
'3'
,
23
,
'4'
,
29
,
'7'
,
30
]
for
i
in
range
(
len
(
list_hero
)):
if
i
%
2
==
1
and
list_hero
[
i
]
>=
s
:
list_hero
.
insert
(
i
-
1
,
a
)
list_hero
.
insert
(
i
,
s
)
break
print
(
list_hero
)
# a={"1":10,'2':21,'3':23,'4':29,'7':30}
...
...
@@ -21,4 +21,3 @@ a["we"]="kj"
if
"a"
in
a
:
print
(
a
[
'a'
])
print
(
a
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
quiz.py
View file @
a43ffe33
...
...
@@ -3,3 +3,8 @@ list_hero=['赵一',30,'丁二',37,'孙五',52,'王猛',89,'周亮',98]
dict_hero
=
{
'赵一'
:
30
,
'丁二'
:
37
,
'孙五'
:
52
,
'王猛'
:
89
,
'周亮'
:
98
}
print
(
len
(
list_hero
))
print
(
len
(
dict_hero
))
dict_hero
[
"赵一"
]
=
40
dict_hero
[
"周亮"
]
=
128
print
(
dict_hero
)
dict_hero
[
"猴十"
]
=
70
print
(
dict_hero
)
This diff is collapsed.
Click to expand it.
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