It's difficult to tell what is being asked开发者_如何学编程 here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical andcannot be reasonably answered in its current for
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.
精彩评论