Count, index out of range [closed]
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.
精彩评论