python:list index out of range
来源:学生作业帮 编辑:作业帮 分类:英语作业 时间:2024/05/21 13:05:59
python:list index out of range
给序列num排序,num是一组数字组成的序列
m=0
while m
给序列num排序,num是一组数字组成的序列
m=0
while m
遇到这种情况 不妨把它打印出来:
num=[2,3,4,6,1]
m=0
while m>
1
2
3
4
Traceback (most recent call last):
File "C:\Documents and Settings\Administrator\妗岄溃\1.py", line 4, in
IndexError: list index out of range
这样你可以知道了把,在m=4的那个循环那里出了问题,因为这个序列长度为5,它不可能有num[5]的情况,就叫做溢出了(list index out of range),所以在if num[m]
num=[2,3,4,6,1]
m=0
while m>
1
2
3
4
Traceback (most recent call last):
File "C:\Documents and Settings\Administrator\妗岄溃\1.py", line 4, in
IndexError: list index out of range
这样你可以知道了把,在m=4的那个循环那里出了问题,因为这个序列长度为5,它不可能有num[5]的情况,就叫做溢出了(list index out of range),所以在if num[m]
python:list index out of range
python为什么老是显示IndexError: list index out of range?求纠错
string index out of range
String index out of range:-1
scan line index out of range
String index out of range:0
请问“list index out of bounds”是什么意思?
List index out of bounds什么意思?
list index out of bound(1)是什么意思
List index out of bounds (-1)是什么意思
list index out of bounds是什么意思
list index out of bound(2)