How can I use python iter here? I want to print prime numbers one by one by using “next” method and set a limit e.g up to 100.

```
def prime(num):
    i = 2

    while i < num:
        if (num % i == 0):
            return False
        i += 1
    return True

def prime_generator():
    i = 2
    while True:
        if (prime(i)):
            yield i
        i += 1

for num in prime_generator():
    if (num > 100):
        break
    print(num)

```