Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
bellcode
/
lesson1_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
660f2b8e
authored
Dec 20, 2019
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
56e1a307
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
52 additions
and
0 deletions
.DS_Store
text1.py → test1.py
test11.py
test12.py
test13.py
test14.py
test15.py
text2.py → test2.py
text3.py → test3.py
text4.py → test4.py
text5.py → test5.py
.DS_Store
View file @
660f2b8e
No preview for this file type
te
x
t1.py
→
te
s
t1.py
View file @
660f2b8e
File moved
test11.py
0 → 100644
View file @
660f2b8e
# 创建列表
list1
=
[
23
,
31
,
18
,
10
,
25
,
40
,
21
]
# 将列表反转
list1
.
reverse
()
# 将列表输出
print
(
list1
)
\ No newline at end of file
test12.py
0 → 100644
View file @
660f2b8e
# 创建列表
list1
=
[
31
,
18
,
10
,
25
,
40
,
21
,
23
,
31
,
18
,
10
,
25
,
40
,
21
]
# 获取列表第3位元素并输出
print
(
list1
[
3
])
# 获取列表第5位元素并输出
print
(
list1
[
5
])
# 获取列表第7位元素并输出
print
(
list1
[
7
])
# 获取列表第9位元素并输出
print
(
list1
[
9
])
\ No newline at end of file
test13.py
0 → 100644
View file @
660f2b8e
# 创建集合
set1
=
{
12
,
31
,
45
,
13
,
24
}
# 在集合里添加元素20
set1
.
add
(
20
)
# 输出集合
print
(
set1
)
\ No newline at end of file
test14.py
0 → 100644
View file @
660f2b8e
# 将变量sum初始化
sum
=
0
# 使用for循环,将变量i在0到99取值
for
i
in
range
(
100
):
# 每次循环一次,i加1
i
+=
1
# 每循环一次,sum加i
sum
=
sum
+
i
# 输出求和结果
print
(
sum
)
\ No newline at end of file
test15.py
0 → 100644
View file @
660f2b8e
# 创建空集合
set1
=
set
([])
# 设置常量
a
=
2
# 在101到201之间循环
for
i
in
range
(
101
,
201
):
# 判断是否有余数
if
i
%
a
==
0
:
# 能除尽就继续
continue
# 除不尽就添加到集合
else
:
set1
.
add
(
i
)
# 输出集合
print
(
set1
)
\ No newline at end of file
te
x
t2.py
→
te
s
t2.py
View file @
660f2b8e
File moved
te
x
t3.py
→
te
s
t3.py
View file @
660f2b8e
File moved
te
x
t4.py
→
te
s
t4.py
View file @
660f2b8e
File moved
te
x
t5.py
→
te
s
t5.py
View file @
660f2b8e
File moved
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