list1 = [1, 2, 3, 4, 5] # define list
# After list1.append() operations
print('without index')
for value in list1:
print(value, end=' ')
print()
print('with index ①')
for index in range(len(list1)):
print(f'list1[{index}] = {list1[index]}')
print('with index ②')
i = 0
for value in list1:
print(f'list1[{i}] = {value}')
i += 1
10-27
7127
“相关推荐”对你有帮助么?
-
非常没帮助
-
没帮助
-
一般
-
有帮助
-
非常有帮助
提交