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
๐ŸŒ
GeeksforGeeks
geeksforgeeks.org โ€บ python โ€บ python-range-for-float-numbers
Python - range() for Float Numbers - GeeksforGeeks
July 23, 2025 - def float_range(start, stop, step): while start < stop: yield start start += step # Use the float_range generator to iterate over a range of floats for i in float_range(0, 2, 0.5): print(i)
๐ŸŒ
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.
๐ŸŒ
PYnative
pynative.com โ€บ home โ€บ python โ€บ python range of float numbers
Python range of float numbers
April 13, 2021 - Use NumPyโ€™s arange() and linspace() functions to use decimal numbers in a start, stop and step argument to produce a range of floating-point numbers. Use Python generator to produce a range of float numbers without using any library or module.
๐ŸŒ
TechBeamers
techbeamers.com โ€บ python-float-range
Generate Floating Point Range in Python - TechBeamers
November 30, 2025 - You can restrict it by using a fixed precision value. Hence, it could be possibly the reason for range() not allowing floats. You can write a custom Python function like the one below.
๐ŸŒ
TutorialKart
tutorialkart.com โ€บ python โ€บ python-range โ€บ python-range-float
Python Range with Floating Point Numbers
January 17, 2021 - Python Range Float - To generate a range of floating point numbers, we can use numpy.arange() function that works just like Python builtin range() function but with floating points as well.
๐ŸŒ
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
Find elsewhere
๐ŸŒ
CodeRivers
coderivers.org โ€บ blog โ€บ range-with-float-python
Working with `range`-like Function for Floats in Python - CodeRivers
February 22, 2026 - The syntax is range(start, stop, step), where start (default 0), stop (exclusive), and step (default 1) are all integers. The reason it doesn't support floats is mainly due to how Python's integer arithmetic is more straightforward and efficient compared to floating-point arithmetic.
๐ŸŒ
YouTube
youtube.com โ€บ data science tutorials
Python 3 Programming Tutorial | How to create range values for float data type - YouTube
In this python 3 programming tutorial, I have talked about how you can create range of float values which is directly not possible using the range function. ...
Published: July 4, 2018
Views: 1K
๐ŸŒ
CodeRivers
coderivers.org โ€บ blog โ€บ python-float-in-range
Python `float` in `range`: A Comprehensive Guide โ€” CodeRivers
Understanding this concept is crucial for various numerical computations, data analysis, and scientific programming tasks where precise control over a sequence of floating - point values is required. In Python, the range function is a powerful tool for generating sequences of integers.
๐ŸŒ
Tpoint Tech
tpointtech.com โ€บ range-of-float-in-python
Range of float in python - Tpoint Tech
March 17, 2025 - In Python, the range of float values depends on the implementation and the platform.
๐ŸŒ
Codingem
codingem.com โ€บ home โ€บ range of floats in python: a step-by-step guide (3 ways to do it)
Range of Floats in Python: A Step-by-Step Guide (3 Ways to Do It)
November 1, 2022 - To create a range of floats in Python, you cannot use the range() function directly. This is because the range() function only supports integers.
๐ŸŒ
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.

๐ŸŒ
Python.org
discuss.python.org โ€บ ideas
Float contained in range - Ideas - Discussions on Python.org
September 7, 2023 - I have found that checking if a float number falls inside a range() doesnโ€™t work, always giving False: >>> 1.0 in range (0, 2) True >>> 1.5 in range (0, 2) False I can understand that range() can only accept integer vaโ€ฆ
๐ŸŒ
CodeRivers
coderivers.org โ€บ blog โ€บ python-range-with-float
Python Range with Float: A Comprehensive Guide โ€” CodeRivers
Understanding how to work with floating - point ranges is crucial in various applications such as numerical analysis, data science, and scientific computing. In Python, the range() function is a fundamental tool for generating sequences of integers. However, there are scenarios where we need to work with sequences of floating-point numbers.
๐ŸŒ
Unanswered
unanswered.io โ€บ home โ€บ technology โ€บ how to create a range of floats in python
How to Create Float Ranges in Python (Beyond range())
July 30, 2026 - You can build a custom generator function using yield to mimic range() behavior with floats without external libraries. A while loop offers a simple way to generate float sequences when you prefer pure Python.
๐ŸŒ
w3resource
w3resource.com โ€บ python-exercises โ€บ math โ€บ python-math-exercise-72.php
Python Math: Create a range for floating numbers - w3resource
August 11, 2025 - Write a Python program to create a range for floating numbers. ... #https://gist.github.com/axelpale/3e780ebdde4d99cbb69ffe8b1eada92c def frange(x, y, jump=1.0): i = 0.0 x = float(x) # Prevent yielding integers. y = float(y) # Comparison converts y to float every time otherwise.
๐ŸŒ
YouTube
youtube.com โ€บ nevsky.programming
How to get a random number between a float range in python - YouTube
In this tutorial we're going to show you how to get a random number between a float range in python 3.
Published: July 1, 2018
Views: 562
๐ŸŒ
Medium
medium.com โ€บ analytics-vidhya โ€บ random-floats-in-any-range-9b40d30b637b
Random Floats in Any Range. I was recently in a situation where Iโ€ฆ | by Christian Clausen | Analytics Vidhya | Medium
May 25, 2020 - But we still need to be careful with the range as we cannot add the numbers (due to the same overflow). The solution is to push in the division onto each component: The key insight being that no matter what numbers we add, if they have both been divided with two they can never overflow. The code follows from the formula: float midpoint = max/2 + min/2; float half_range = max/2 - min/2; int plus_minus = rand.nextBoolean() ?
๐ŸŒ
Iditect
iditect.com โ€บ faq โ€บ python โ€บ python-range-for-floats.html
Python range() for floats
def float_range(start, stop, step): while start < stop: yield start start += step for num in float_range(0.0, 1.0, 0.2): print(num) "Python: Generate a range of floats with given step size"