Intern Kiet
Intern Kiet

Reputation: 71

How to get all integers between two float values?

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?

Upvotes: 5

Views: 3009

Answers (1)

miszcz2137
miszcz2137

Reputation: 914

Try this:

import math
list(range(math.ceil(num1), math.floor(num2) + 1))

Upvotes: 8

Related Questions