names = ["小蓝", "小青", "小红", "小黄", "小白"]
print(names)
print(names[0])
for i in names:
print(i)
i = 0
while i < len(names):
print(names[i])
i += 1
schoolNames = [['北京大学', '清华大学'],
['南开大学', '天津大学', '浙江大学'],
['福州大学', '上海大学']]
print(schoolNames[1][1])
names = ["小蓝", "小青", "小红", "小黄", "小白"]
print(names.index("小红"))
print(names.count("小红"))
print("小红" in names)
print("小红" not in names)
names.append("小猴")
print(names.append("小猴"))
print(names)
names.extend("小紫")
print(names)
names.insert(1, "小绿")
print(names)
del names
print(names)
names.pop()
print(names)
names.pop(0)
print(names.pop(0))
names.remove("小青")
print(names)
names.clear()
print(names)
names[0] = "小黑"
print(names)
num2 = [23, 33, 67, 12, 9, 67]
num2.sort()
print(num2)
num2.sort(reverse=True)
print(num2)
num2.reverse()
print(num2)
num = [i for i in range(1, 6)]
print(num)
|