Q: myRange function giving output of None. Why is this? I am to create a function called myRange that behaves like range. This is for class and the instructions tell me to use Python's help for range but I am not understanding it at all. I am a complete greenhorn with Python. Please do not provide modules or methods.
def myRange(stop,start=None,step=None):
    outputList = []
    if stop == 0:
        start= 0
        stop = start
        step = 1

   

    
    
        return()





print(myRange(10))

I am expecting just this portion to give the output range of 10 displayed in a list.

A: # define a function called 'myRange' which takes 3 arguments,
# stop, start and step, where start and step default to None
def myRange(stop,start=None,step=None):

    # set the value of outputList to an empty list
    outputList = []

    # if stop is 0, do this block of code below
    if stop == 0:
        # set start to 0
        start= 0
        # set stop to 0 (this is a little
        # redundant as we already know stop is 0 at this point)
        stop = start

        # set step to 1
        step = 1

        # return an empty Tuple
        return()


print(myRange(10))

So you've definitely made a start and have some code down and running and this is always a huge milestone. It'll just take some figuring out and then I'm sure you'll get it. As you don't want specific code, here are some pointers:

*

*What do you want the function to return? Right now it doesn't return anything. range in python returns a sequence of numbers, from start to stop, counting up by step. It goes up by 1 by default and starts at 0 by default


*How would you describe the instructions for a human to perform this action? This can help you figure out what the code needs to do


*The code indented under an if statement will only be run if that if statement is true
Hopefully that'll get you going in the right direction. Happy to help some more if you get stuck
