Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson6-5-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
9d2e7c2e
authored
4 years ago
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
d84e0f6c
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
41 additions
and
3 deletions
diy.py
test.py
test2.py
diy.py
View file @
9d2e7c2e
...
@@ -4,9 +4,12 @@ name='刘强'
...
@@ -4,9 +4,12 @@ name='刘强'
power
=
66
power
=
66
hero
=
[
'赵一'
,
30
,
'丁二'
,
37
,
'孙五'
,
52
,
'王猛'
,
89
,
'周亮'
,
98
]
hero
=
[
'赵一'
,
30
,
'丁二'
,
37
,
'孙五'
,
52
,
'王猛'
,
89
,
'周亮'
,
98
]
# 自动排序
# 自动排序
for
i
in
range
(
len
(
hero
)):
if
i
%
2
==
1
and
hero
[
i
]
>
power
:
hero
.
insert
(
i
,
name
)
hero
.
insert
(
i
,
power
)
break
print
(
hero
)
print
(
hero
)
\ No newline at end of file
This diff is collapsed.
Click to expand it.
test.py
0 → 100644
View file @
9d2e7c2e
import
random
num_len
=
random
.
randint
(
10
,
20
)
num_list
=
[]
# num_list[2] = 10
for
i
in
range
(
num_len
):
# num_list[i] = random.randint(0,50)
num_list
.
append
(
random
.
randint
(
0
,
50
))
print
(
num_list
)
for
i
in
range
(
len
(
num_list
)
-
1
):
for
x
in
range
(
len
(
num_list
)
-
1
-
i
):
if
num_list
[
i
]
<
num_list
[
i
+
x
+
1
]:
num_list
[
i
],
num_list
[
i
+
x
+
1
]
=
num_list
[
i
+
x
+
1
]
,
num_list
[
i
]
print
(
num_list
)
print
(
num_list
[
0
:
10
:
2
])
This diff is collapsed.
Click to expand it.
test2.py
0 → 100644
View file @
9d2e7c2e
global
x
# def func():
# global x
# x = 10
# x = 2
# print(x)
# func()
# print(x)
x
=
1
print
(
x
)
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