'''
练习:
1、使用循环输出list中的每个元素的索引和元素
2、输出list中除第一个元素以外的其他元素
'''
-------------------------------------------------------------------------------------------------------------------
# 10循环.py
# !/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = '小袋袋'
i = 0
index = 0
nums = [11, 4, 3, 23, 64, 2, 236, 8]
while i < len(nums):
print('[' + str(index) + ']' + str(nums[index]), end = '\n')
index += 1
i += 1
print()
index = 1
while index < (len(nums) - 1):
print(nums[index], end =',')
index += 1
print(nums[index])
print()
------------------------------------------------------------------------------------------------------------------------
【运行结果:】
[0]11
[1]4
[2]3
[3]23
[4]64
[5]2
[6]236
[7]8
4,3,23,64,2,236,8
[Finished in 0.1s]