Python Program to Print Natural Numbers

def display(n):
    while True:
        try:
            n=n+1
            if n==21:
                raise StopIteration
        except StopIteration:
            break
        else:
            print(n, end =" ")
i=0
display(i)

Output:
Python Program to Print Natural Numbers