三种方法打印列表(数组)

#方法一
member = ['小甲鱼', 88, '黑夜', 90, '迷途', 85, '怡静', 90, '秋舞斜阳', 88]
i=0
lenth=len(member)
while i
    print(member[i],member[i+1])
    i+=2
#方法二
member = ['小甲鱼', 88, '黑夜', 90, '迷途', 85, '怡静', 90, '秋舞斜阳', 88]
i=0
for string in member:
    print(member[i],member[i+1])
    i+=2
#方法三
member = ['小甲鱼', 88, '黑夜', 90, '迷途', 85, '怡静', 90, '秋舞斜阳', 88]
for each in range(len(member)):
    if each%2==0:
        print(member[each],member[each+1])

转载于:https://www.cnblogs.com/themost/p/6358876.html

你可能感兴趣的:(三种方法打印列表(数组))