Can't create a list out of float range

Hello, I am right now doing Reggie’s Linear Regression exercise from the Python 3 course. Right now I am stuck with the exercise because i can’t find a way of creating a list from a float range. The message error says that float cannot be interpreted as an integer.

Here is the line of code I am using to create the list:

possible_ms = list(range(-100,100,0.1));

Here is a link to the exercise page: https://www.codecademy.com/courses/learn-python-3/informationals/python3-reggies-linear-regression

Since floats are different than integers they aren’t considered as the same type of data. I would suggest that you turn all the numbers into floats.

For example:

71 is an integer
71. is a float

Yeah I tried that but it still didnt work. I think that the problem is with the range function, that does not accept float numbers.

That is correct. However, take a second and think about the instructions.


Notice it says to use list comprehension…

1 Like

Cannot be done. range() only takes integer arguments.

    [x / 10 for x in range(-100, 101)]