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
56e1a307
authored
Dec 19, 2019
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
save project
parent
313964cb
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
45 additions
and
6 deletions
.DS_Store
lqy2.py
text2.py
text3.py
text4.py
text5.py
.DS_Store
0 → 100644
View file @
56e1a307
File added
lqy2.py
View file @
56e1a307
input_d
=
int
(
input
(
"长:"
))
input_d
=
int
(
input
())
input_h
=
int
(
input
(
"高:"
))
input_h
=
int
(
input
(
"高:"
))
print
(
"面积是"
,
input_d
*
input_h
/
2
)
print
(
"面积是"
,
(
input_d
)
*
(
input_h
)
/
2
)
\ No newline at end of file
\ No newline at end of file
text2.py
View file @
56e1a307
# 创建一个有7个整数的整数列表
list2
=
[
33
,
21
,
30
,
11
,
42
,
23
,
23
]
list2
=
[
33
,
21
,
30
,
11
,
42
,
23
,
23
]
# 返回最小值
# 将列表从小到大排序
print
(
list2
.
index
(
max
(
c
))
)
list2
.
sort
()
\ No newline at end of file
# 将已经从小到大排序的列表进行逆序排列
list2
.
reverse
()
# 找出列表首位数字(即最大值)并乘以4
x
=
list2
[
0
]
*
4
# 输出运算结果
print
(
x
)
\ No newline at end of file
text3.py
0 → 100644
View file @
56e1a307
# 初始化三角形的三个边长
a
=
6
b
=
8
c
=
10
# 乘法运算三角形面积
s
=
a
*
b
/
2
# 输出三角形面积
print
(
s
)
\ No newline at end of file
text4.py
0 → 100644
View file @
56e1a307
# 创建整数列表
list1
=
[
1
,
2
,
3
,
1
,
2
,
1
,
4
,
6
,
3
]
# 用for循环剔除列表里的数字1
for
i
in
list1
:
if
i
==
1
:
list1
.
remove
(
1
)
# 用for循环剔除列表里的数字2
for
i
in
list1
:
if
i
==
2
:
list1
.
remove
(
2
)
# 用for循环剔除列表里的数字3
for
i
in
list1
:
if
i
==
3
:
list1
.
remove
(
3
)
# 输出剔除相同数字后的最终列表
print
(
list1
)
text5.py
0 → 100644
View file @
56e1a307
# 创建字符串列表1
str1
=
"asdfghjkl"
# 将列表1拆分成列表2和3
str2
=
"asdfgh"
str3
=
"jkl"
# 截取字符串2和3,并输出
print
(
str2
[
1
::
2
]
+
str3
[
0
::
2
])
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