range() function in python does not include stop value. Write a generator function equivalent to range() function that includes the stop value also. This function will take three arguments: start, stop and step and will generate the desired list.


In [12]:
def stopRange(start = 0,stop,step = 1):
    '''Generator function equivalent to range() function, but also includes the stop value.
        Paramaters: start (Default = 0), stop, step (Default = 1)'''
    i = start
    while i<=stop:
        yield i
        i+=step
s = stopRange()


  File "<ipython-input-12-b6d4da756c29>", line 1
    def stopRange(start = 0,stop,step = 1):
SyntaxError: non-default argument follows default argument

In [ ]: