[Python] Python arithmetic operator- difference between x//y and x/y [duplicate]

Discussão em 'Python' iniciado por Stack, Março 28, 2025.

  1. Stack

    Stack Membro Participativo

    What is the difference between the operator x//y and x/y in Python? From what is written in my course it says that x//y - "Floor division operator returns the integer part of the integer division of x by y" and for x/y- "Division / operator returns the quotient of x divided by y". I am stuck, please help. Thank you

    I tried print(4//2) and it answered 2 (without decimal) I tried print(4/2) and it answered 2.0 (with decimal)

    I tried print(5//3) and it answered 1 (without decimal) I tried print(5/3) and it answered 1.6666667 (with decimal)

    Continue reading...

Compartilhe esta Página