+ 1
Is int the only data type that can be used under range?
4 Respostas
+ 6
In python range() can only take integer numbers, float is not possible.
+ 2
If your question is related to Kotlin, you habe the following options: IntRange, UIntRange, LongRange, ULongRange and CharRange.
+ 1
In python you could either define your own floatrange() function, or import the NumPy library and use the numpy.arange() function with the same syntax as the range() function.
+ 1
You can also use booleans, but because booleans and small integers require same amount of memory, I think booleans are actually integers in Python, even though they have different class and representation.