I'm trying to create a loop that takes an input value, and creates that many random numbers between 0 and 10, and then puts these values throuh a formula in a loop and saves these values into an array. The following is what I've done:

```
def f(x):
    x**2

def Sample(npts):
    sample = []

    randomlist = random.sample(range(0.0, 10.0), npts)

    for i in range(randomlist):
        y  = f(randomlist)
        sample.append(y)

    print(sample)

```

now here I am getting an error saying that the sample range is being exceeded. This occurrs when I set npts = 100, can someone explain where I am going wrong? Also, I fear that I may have called the wrong value later down the line. So to explain, I am trying to get 100 random values (npts, in this case) between 0 and 10, and these values be the x values that are put through f(x), (in this case the values being multiplied by 2) and then have these new calculated values saved to the array sample each time and then printed at the end.

Hope that makes what I am trying to do clear, so please let me know how to fix the error!