Python 中range len 和for index

num = [1, 2, 3, 4, 5, 6, 7, 8]
print(len(num))
print(range(len(num)))
for index in range(len(num)):
    print("the {} element is {}".format(index, num[index]))

 

posted @ 2021-05-20 17:40  巴黎爱工作  阅读(441)  评论(0编辑  收藏  举报