Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do i get all integers between two values in python?

Tags:

python

I want to get all the integers which are between two float values. Example: I have an interval (2.4 , 5.6). As an output I want to have (3, 4, 5).

Is there any function that does this?

like image 400
Intern Kiet Avatar asked Mar 02 '23 18:03

Intern Kiet


1 Answers

Try this:

import math
list(range(math.ceil(num1), math.floor(num2) + 1))
like image 105
miszcz2137 Avatar answered Mar 05 '23 17:03

miszcz2137