Commit c83ffb7d by BellCodeEditor

auto save

parent 4ce966e1
Showing with 55 additions and 0 deletions
# 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)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment