Mar-23-2019, 02:05 PM
(This post was last modified: Mar-23-2019, 02:26 PM by Yoriz. Edited 1 time in total.

*Edit Reason: Title*)
I am having some problems with this task.

I am supposed to use the command range to generate a list of 100 numbers

between 0 and 1 (both 0 and 1 should be included) and a list comprehension.

I have tried by using np.arange, but as a fairly new user, I am not sure if is the same

thing as range. I have tried to use 'range' before but it does not work with floats.

Since the numbers needed to be generated must be 100, I have tried to look for a specific

command that allows me to find out how many numbers are generated, but I haven't had any success.

Here is the code:

I am supposed to use the command range to generate a list of 100 numbers

between 0 and 1 (both 0 and 1 should be included) and a list comprehension.

I have tried by using np.arange, but as a fairly new user, I am not sure if is the same

thing as range. I have tried to use 'range' before but it does not work with floats.

Since the numbers needed to be generated must be 100, I have tried to look for a specific

command that allows me to find out how many numbers are generated, but I haven't had any success.

Here is the code:

import numpy as np from scipy import * from numpy import array for i in np.arange(0, 1.01, 0.0101): print(i, end=', ')