here's a small trick in python,
let's say you want to count the number of items in a list while following a certain condition, for that you're usually gonna do something like,
this_list = [(some stuff)]
count = 0
for i in this_list:
if (insert condition):
count += 1