Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Administrator
/
lesson4_5
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
c83ffb7d
authored
Mar 18, 2023
by
BellCodeEditor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
auto save
parent
4ce966e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
55 additions
and
0 deletions
1.py
1.py
0 → 100644
View file @
c83ffb7d
# s=(1,2,4,5,3)#有序,不能修改可用切片
# #b=s(1:3)#切片中括号,不是小括号,元组切完还是元组
# #b=s[1:3]
# #b=s[1:5:2]
# c=s[1::2]
# print(c)
# a=[1,2,3,4,5]
# aa=a[1:3]
# print(aa)
# a=(1,2)
# b=(1,3,4,5,1,2,3,12,3)
# # c=len(b)
# c=b.count(3)#返回元组钟定值出现的次数
# d=b.index(3)#
# print(d)
# # tuple() list()
# list=[1,2,3,4,5,6132,12,1]
# a=len(list)
# append('abd')#末尾追加
# insert(2,'123')
# pop(2)#加索引,不加删除最后一个
# remove('123')#删除指定元素
# del a #删除整个列表
# clear() #清空列表内容。
# list=[1,2,3,4,5,6132,12,1]
# a=list.copy()#
# print(a)
#列表拼接
# a=[1,2]
# b=[2,3]
# b=b+a
# print(b)
# for i in range(0,101):
# sum=sum+i
# print(sum)
# (1)+(1+2)+(1+2+3)+....+(1+2+3+...+100)
sum
=
0
for
j
in
range
(
1
,
102
):
for
i
in
range
(
1
,
j
):
sum
=
sum
+
i
print
(
sum
)
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