开发者

Count, index out of range [closed]

It's difficult to tell what is being asked开发者_如何学编程 here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 11 years ago.

I have this code to return a number but I get the error: IndexError: index out of range: 0 with the return.

nbus=1

users = []

for i in range(nb):

    ind = (int(nbus)-1)

ind= ind +1 

return users[ind]

Do you know why?

Thanks


You never append to users, therefore it contains no elements and has no valid indexes.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜