people
is a list. people[0]
however is an integer. And, as your error says, you can't use len
with integers since they are non-iterable.
If you want to see if the length of people
is not 0
, remove [0]
:
if len(people)!=0:
Or, if you want to see if people[0]
does not equal 0
, remove len
:
if people[0]!=0: