Commit a8b508cb by BellCodeEditor

auto save

parent b250abfe
Showing with 70 additions and 3 deletions
# 使用二分查找法,找出9和20在列表里面的索引
num_list = [1, 3, 5, 8, 11, 15, 17, 18, 20, 21]
\ No newline at end of file
# 元组,列表,字典,
#元组
# a=(1,12,3,4,5,1,2,2,3,1)#有序不可更改
# b=(12,23,34)
# print(a[-1::-3])
# print(len(a))
# print(a[1])
# a=(1)
# b=(2,)
# print(type(a))
# print(type(b))
# a=list(a)
# a[1]=2
# a=tuple(a)
# print(a)
# c=a*2
# print(c)
#count() index()
# print(a.count(1))
# print(a.index(3))
a=['83','ad','b5','c712','6','12','3','554']
# a.insert(1,90) a.append(1212)
# a.pop(索引) a.remove(元素) del clear()
# a.clear()
# del a
# print(a)
# b=a.copy()
# c=list(a)
# d=a
# print(b,c,d,a)
# b=['1','2']
# # c=a+b
# a.extend(b)
# print(a)
# count() extend() index() reverese() sort()
# a.sort(reverse=False,key=func())#默认是false,True
# print(a)
# cars=[
# {'car':'bmw','year':1661},
# {'car':'benz','year':1990},
# {'car':'volvo','year':1668},
# {'car':'rr','year':161}
# ]
# def func(a):
# return a['year']
# cars.sort(reverse=True,key=func)
# print(cars)
a={'a':1,'b':2}
b={1,2,4,2,1,2,3,1,1,1,1,1}
# c={2,1,3,4}
# if b==c:
# print(1)
# for i in b:
# print(i)
# for i in range(len(b)):
# print(b[i])
# c=[1,2,3]
# d=(1,2,3)
# add() updata() remove() del clear() union()
字典,
1key 1value 2 items()
\ No newline at end of file
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