human
I am working on the file "Section 2 - Advance Python/Chapter S2.01 - Functional Programming/02_03_iter.ipynb".
The first task is:
iter()
The iter() method returns an iterator for the given object.
Syntax:
python
iter(object[, sentinel])
Where object is an object based on which the iterator needs to be constructed. The behavior of iterator is dependent on the value of sentinel, if sentinel is not provided then object should be an interator and the construct will behave as such, where as if sentinel is provided then object should be callable, and value returned will be treated as next call. Iteration ends when the value retuned equals to value in sentinel
Can you write Python program for it?

=====
Write me a the Python program you requested?
assistant
#Here is the Python program you requested.

class MyDummy(object):
    def __init__(self):
        self.lst = [1, 2, 3, 4, 5, 6]
        self.i = 0
        
    def __call__(self):
        ret = self.lst[self.i]
        self.i += 1
        return ret

d = MyDummy()

for a in iter(d, 3):
    print(a, end=" ")

m = MyIter([1, 2, 3, 4, 5, 6])
for a in iter(m):
    print(a, end=" ")