def test() print("You are in the method") yield 1 print("You are again back to the method") yield 2 for a in test(): print("You are in the block #{}".format(a))