Difference between / and // in Python 3 (integer division Vs Floor division)







  • What is the difference between / and // in Python

    In python, / is used for division and ALWAYS results in a floating-point value.
    // is used for floor division. Floor Division always returns an integer by truncating the decimal part.
    For example - 5/2 will give 2.5 and 5//2 will give 2 as the decemal part will be removed in floor division




datai analytics