floor-division

C# and Python result difference – basic Math

C# and Python result difference – basic Math Question: So I have tried the same math in c# and python but got 2 different answer. can someone please explain why is this happening. def test(): l = 50 r = 3 gg= l + (r – l) / 2 mid = l + (r – …

Total answers: 1

Two forward slashes in Python

Two forward slashes in Python Question: I came across this sample of code from a radix sort: def getDigit(num, base, digit_num): # pulls the selected digit return (num // base ** digit_num) % base What does the // do in Python? Asked By: Biff || Source Answers: // is the floor division operator. It produces …

Total answers: 3

What is the difference between '/' and '//' when used for division?

What is the difference between '/' and '//' when used for division? Question: Is there a benefit to using one over the other? In Python 2, they both seem to return the same results: >>> 6/3 2 >>> 6//3 2 Asked By: Ray || Source Answers: // is floor division. It will always give you …

Total answers: 16