python range | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

python range

Why is that not possible to create a list using a range and a step with float number. For example, y = list(range(10, 15,.5)) print(y) throws this error: TypeError: 'float' object cannot be interpreted as an integer Is there any way to handle this issue using a range function? thanks!

1st Sep 2020, 5:27 PM
teemran
teemran - avatar
2 Answers
- 1
You have 15,.5
1st Sep 2020, 7:39 PM
Tanjil Khan
Tanjil Khan - avatar
+ 2
thanks, @~swim~ that worked and make a lot of sense
8th Sep 2020, 6:39 PM
teemran
teemran - avatar