You can either use:

[x / 10.0 for x in range(5, 50, 15)]

or use lambda / map:

map(lambda x: x/10.0, range(5, 50, 15))
Answer from Grzegorz Rożniecki on Stack Overflow
🌐
Note.nkmk.me
note.nkmk.me › home › python
Maximum and Minimum float Values in Python | note.nkmk.me
August 11, 2023 - In Python, the float type is a 64-bit double-precision floating-point number, equivalent to double in languages like C. This article explains how to get and check the range (maximum and minimum values ...
🌐
Python⇒Speed
pythonspeed.com › articles › float64-float32-precision
The problem with float32: you only get 16 million values
February 1, 2023 - Switching from numpy.float64 ... cuts memory usage in half. But it does so at a cost: float32 can only store a much smaller range of numbers, with less precision....
Discussions

python - range() for floats - Stack Overflow
This is quite a twisted argument. range() should simply be looked at iteration generator and whether it is used in for loop or to index something should be left to callers. People have been using floats in for loop for millenia and above justifications are nonsensical. People in Python committees ... More on stackoverflow.com
🌐 stackoverflow.com
python 2.7 range accepts numpy float16, float32, complex when it should raise TypeError
In python 2.7, range accepts numpy.float16 and np.float32, np.float128, complex64 and complex128 as inputs, which it really shouldn't. Reproducing code example: >>> import numpy as np ... More on github.com
🌐 github.com
6
October 11, 2018
python - The real difference between float32 and float64 - Stack Overflow
I want to understand the actual difference between float16 and float32 in terms of the result precision. For instance, NumPy allows you to choose the range of the datatype you want (np.float16, np. More on stackoverflow.com
🌐 stackoverflow.com
float numbers with range () function
Yes, range(0, 101) literally gives the integers from 0 to 100. If you want to know if a number is between two values, use a chained comparison: while 0 <= score < 101: Although note you shouldn't get an actual error, just a False. What exact error message did you see? More on reddit.com
🌐 r/learnpython
4
2
April 19, 2022
🌐
PYnative
pynative.com › home › python › python range of float numbers
Python range of float numbers
April 13, 2021 - NumPy doesn’t come with default Python installation. You can install it using pip install numpy. ... Import numpy module using the import numpy as np statement. ... Pass float numbers to its start, stop, and step argument. For example, np.arange(0.5, 6.5, 1.5) will return the sequence of floating-point numbers starting from 0.5 up to 6.5. ... import numpy as np # range for floats with np.arange() for i in np.arange(0, 4.5, 0.5): print(i, end=', ') # Output 0.0, 0.5, 1.0, 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, # Example 2 for i in np.arange(5.5, 15.5, 2.5): print(i, end=' ') # Output 5.5, 8.0, 10.5, 13.0,Code language: Python (python) Run
🌐
University of Texas
cs.utexas.edu › ~mitra › csSpring2017 › cs303 › lectures › math.html
Doing Math in Python
32-bit floating point numbers have lower precision than 64-bit numbers. There is also a limit to how big or how small a floating point number you can represent. For a 32-bit representation the range is (+/-) 3.4E38 and for 64-bit representation the range is (+/-) 1.8E308.
🌐
Pythoninformer
pythoninformer.com › python-libraries › numpy › data-types
PythonInformer - Data types
September 14, 2019 - float64 numbers store floating point numbers in the same way as a Python float value. They are sometimes called double precision. float32 numbers take half as much storage as float64, but they have considerably smaller range and .
🌐
GitHub
github.com › numpy › numpy › issues › 12149
python 2.7 range accepts numpy float16, float32, complex when it should raise TypeError · Issue #12149 · numpy/numpy
October 11, 2018 - In python 2.7, range accepts numpy.float16 and np.float32, np.float128, complex64 and complex128 as inputs, which it really shouldn't. Reproducing code example: >>> import numpy as np >>> range(np.float16(4)) [0, 1, 2, 3] >>> range(np.fl...
Author   hmaarrfk
Find elsewhere
🌐
TechBeamers
techbeamers.com › python-float-range
Generate Floating Point Range in Python - TechBeamers
November 30, 2025 - Do you wish to learn how to generate a float range of numbers in Python? In this tutorial, you will find many ways to produce floating point values within a given range. We’ve provided several Python…
🌐
Spark By {Examples}
sparkbyexamples.com › home › python › python range() with float values
Python range() with float values - Spark By {Examples}
May 31, 2024 - Let's see how to return the range of float values in Python by using the numpy.arange() and numpy.linspace() methods. Python range() will not be
🌐
Python Data Science Handbook
jakevdp.github.io › PythonDataScienceHandbook › 02.01-understanding-data-types.html
Understanding Data Types in Python | Python Data Science Handbook
array([ 1., 2., 3., 4.], dtype=float32) Finally, unlike Python lists, NumPy arrays can explicitly be multi-dimensional; here's one way of initializing a multidimensional array using a list of lists: In [11]: # nested lists result in multi-dimensional arrays np.array([range(i, i + 3) for i in [2, 4, 6]]) Out[11]: array([[2, 3, 4], [4, 5, 6], [6, 7, 8]]) The inner lists are treated as rows of the resulting two-dimensional array.
🌐
Reddit
reddit.com › r/learnpython › float numbers with range () function
r/learnpython on Reddit: float numbers with range () function
April 19, 2022 -

Hi, I have a section of code which takes a score from the user, typecasts it into a float value and saves it under the variable name "score". Then I have a line of code which reads:

while score not in range(0, 101):

However, when I input a float, I get an invalid input error message from python. I think it's because I can't use the range() function with floats. Is there a way around this? If anyone knows how to solve this, then your help would be greatly appreciated. Thank you in advance.

🌐
Wikipedia
en.wikipedia.org › wiki › Single-precision_floating-point_format
Single-precision floating-point format - Wikipedia
3 weeks ago - Single precision is termed REAL(4) or REAL*4 in Fortran; SINGLE-FLOAT in Common Lisp; float binary(p) with p≤21, float decimal(p) with the maximum value of p depending on whether the DFP (IEEE 754 DFP) attribute applies, in PL/I; float in C with IEEE 754 support, C++ (if it is in C), C# and Java; Float in Haskell and Swift; and Single in Object Pascal (Delphi), Visual Basic, and MATLAB. However, float in Python, Ruby, PHP, and OCaml and single in versions of Octave before 3.2 refer to double-precision numbers.
🌐
w3resource
w3resource.com › numpy › data-types.php
NumPy: Data types - w3resource
>>> import numpy as np >>> np.array([3, 5, 7], dtype='f') array([3., 5., 7.], dtype=float32)
🌐
Simplilearn
simplilearn.com › home › resources › software development › python float() function: key concepts [with examples]
Python float() Function: Key Concepts [With Examples]
November 27, 2024 - Learn how the float() function in Python converts a specified value into a floating point number. Syntax: float(value). A key function for numeric conversions.
Address   5851 Legacy Circle, 6th Floor, Plano, TX 75024 United States
🌐
Javatpoint
javatpoint.com › range-of-float-in-python
Range of float in python - Javatpoint
Range of float in python with tutorial, tkinter, button, overview, canvas, frame, environment set-up, first python program, etc.
🌐
GeeksforGeeks
geeksforgeeks.org › python › python-range-for-float-numbers
Python - range() for Float Numbers - GeeksforGeeks
July 23, 2025 - We created a function float_range() that yields values from start to stop with a step size of 0.5.
🌐
NumPy
numpy.org › doc › stable › user › basics.types.html
Data types — NumPy v2.4 Manual
NumPy supports a much greater variety ... than Python does. This section shows which are available, and how to modify an array’s data-type. NumPy numerical types are instances of numpy.dtype (data-type) objects, each having unique characteristics. Once you have imported NumPy using import numpy as np you can create arrays with a specified dtype using the scalar types in the numpy top-level API, e.g. numpy.bool, numpy.float32, ...
🌐
Delft Stack
delftstack.com › home › howto › python › python range float
How to Get Range of Floating Numbers in Python | Delft Stack
February 2, 2024 - Generator comprehension is a syntactic approach similar to list comprehension that creates an iterable generator object in Python. We can access the new value from the generator by using the next() method or iterate through the whole sequence using the for loop. The below example code demonstrates how to use the generator comprehension to get the range of floats in Python.