'for loop pagination prints page result as 'num.0' [duplicate]

code below is a part of web scraper and it prints page numbers as page number.0

How to remove that .0 and only print page numbers?

for page in range(0, 1040, 20):
    print(f'===== Page {(page/20)+1} =====')

# print result  ===== Page 1.0 =====


Solution 1:[1]

Dividing automatically makes the result turn into a Float type even if "page" was set as an int() type prior. Add the int() method in print to convert it into an integer.

print(f'===== Page {int((page/20)+1)} =====')

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1