- range 和len的并用
list=["Monday","Tuesday","Wednesday","Thusday",
"Friday","Saturday","Sunday"]
for i in range(len(list)):
print list[i]
- Range函数的作用是顺次取出序列的数
- Len函数的作用是求列表的长度(长度为7)以元素的个数
- 两者的配合使用是顺次取出列表中的数据
Ctrl+C直接终止程序执行
时间: 2024-11-02 17:29:07
list=["Monday","Tuesday","Wednesday","Thusday",
"Friday","Saturday","Sunday"]
for i in range(len(list)):
print list[i]
Ctrl+C直接终止程序执行