IndexError: list index out of range How can i solve this and make it run? [duplicate]

First thing you should know is, randint(start, end) function randomly generates number starting from the start to end. So in your case, it generates a number more than what indexes you have in your lists. You can do,

people = randint(0, len(persons)-1)

Leave a Comment