I have a bunch of objects in a list that have a field called "number". Let the list be called "collected".
How would I find the object in the list that has "4" in its field?
I tried
class stats:
def __init__(self, numba):
self.Number = int(numba)
if (collected.Number == 4):
#do stuff
However, I get an error that says 'list' object has no attribute 'number' And even if this worked, how would I be able to see which index of the list has even found the "4"?