I want to implement an iterator class(without using python built-in iterator) to only iterate over multiples of 3(could be other number,odd or even number but lets stick with 3 for now). The code should run on the given arraylist inside main() function and return multiples of 3.
This is my pseudocode below. Pretty new to python and don't know how iterator is implemented, would appreciate any help to make this code work:
class threeIterator:
    def __init__(self):
        self.it=it
        self.currval=currval
    def hasNext(self):
        while currval%3!=0 and it.hasNext():
               temp=it.next()
               if temp==None:
                   continue
               currval=temp
          if currval%3==0:
                 return True
     def next(self):
         if hasNext():
            res=currval
            currval=1
            return res
          else:
               raise exception("No such value")
        def main():
           arraylist=[random elements]
           arraylist.threeIter()
also, what is the best way to write a test case for it so i don't have to manually input numbers? thanks
 
     
    