【python】新创建一个列表,并向内添加元素 and 列表中查询最大值位置和最小值位置

1. 新创建一个空的列表,并加入新的元素

(1)创建空列表

tabulation1 = list()

(2)append(方法一)

tabulation1.append('紫霞')
直接往末尾插入
(3)insert(方法二)
tabulation1.insert(1,'紫霞')
指定位置插入

2.python寻找list中最大值、最小值并返回其所在位置
c = [-10,-5,0,5,3,10,15,-20,25]

print c.index(min(c))  # 返回最小值的位置
print c.index(max(c)) # 返回最大值的位置
 
原文地址:https://www.cnblogs.com/coreLeo/p/15102357.html