Untitled

Anonymous
plain_text
02/14/2024 5:47 PM
492 B
18
Indexable
def range_generator(end, start=0, step=1):
    while(start < end):
        yield start
        start = start + step
    while(start > end):
        yield start
        start = start + step

for i in range_generator(10, start=1, step=3):
    print(i)

for i in range_generator(5):
    print(i)

for i in range_generator(0, start=10, step=-4):
    print(i)
Editor is loading...
Leave a Comment