True division vs floor division
/ is true division: in Python 3 it always returns a float for int and float operands (PEP 238 changed this from Python 2). // is floor division: it divides and rounds toward negative infinity, not toward zero. The result type follows the operands: int // int is an int, anything involving a float gives a float (3.0, not 3).
Why floor, not truncate: floor division is paired with the modulo operator so that a == (a // b) * b + a % b always holds and a % b takes the sign of b. That makes things like wrap-around indexing ((i - 1) % n) behave sensibly for negatives, whereas C and Java truncate and produce negative remainders. This is the number one gotcha for engineers coming from those languages: -7 // 2 is -4 in Python.
Trade-offs and alternatives: use // when you need whole-number results, for example pagination or bucket indices, and use divmod when you need quotient and remainder together. For exact fractions use fractions.Fraction; for money use decimal.Decimal or integer cents. For large ints, / converts to float and can lose precision or raise OverflowError, so // (or Fraction) is the safe choice.
Common mistakes: using int(a / b) for integer division (it goes through float and can be wrong for large values and gives a different rounding direction for negatives), assuming // always returns an int, and trusting float // results (see 1 // 0.1). When porting Python 2 code, every bare / on ints silently changes meaning, which is a classic migration bug.
0-2 years experience
2-5 years experience
5-8 years experience
8+ years experience