4-1 披薩
food = ['a' , 'b' , 'c']
for pizza in food :
print(pizza)
print("i really like pizza!")
a4-6奇數b c
i really like pizza!
[finished in 0.9s]
#4-6:本題主要考察的是range()函式的步長問題,可以制定乙個步長在使用的過程中
numbers = list(range(1,20,2))
print(numbers)
[1, 3, 5, 7, 9, 11, 13, 15, 17, 19]4-8 立方[finished in 0.8s]
ans = [value**3
forvalue
in range(1,10)]
print(ans)
[1, 8, 27, 64, 125, 216, 343, 512, 729]還有乙個非常重要的列表複製[finished in 0.9s]
lista = listb不等於複製了,而只是lista只是listb的乙個別名
應該是lista = listb[:]
Python(4)操作列表
使用for迴圈 magicians a b c for magician in magicians print magician.title that was a great trick print i can t wait to see you,magician.title n print tha...
python學習筆記 列表操作
python 列表操作 bicycles trek cannondale redline specialized bicycle bicycles n 1 bicycle bicycles 1 bicycles.insert n 1,long del bicycles n 1 bicycle bic...
Python學習筆記 列表操作
1.列表直接定義 member 哈哈 呵呵 嘻嘻 member 哈哈 呵呵 嘻嘻 member 哈哈 呵呵 嘻嘻 member 哈哈 呵呵 嘻嘻 嘿嘿 3.新增列表.extend 1 兩種錯誤 member.extend 小明 小紅 traceback most recent call last f...