[Python] What is the difference between int() and floor() in Python 3?

Discussão em 'Python' iniciado por Stack, Agosto 12, 2025.

  1. Stack

    Stack Membro Participativo

    In Python 2, floor() returned a float value. Although not obvious to me, I found a few explanations clarifying why it may be useful to have floor() return float (for cases like float('inf') and float('nan')).

    However, in Python 3, floor() returns integer (and returns overflow error for the special cases mentioned before).

    So what is the difference, if any, between int() and floor() now?

    Continue reading...

Compartilhe esta Página