← BYTES
Python·Starter·Ref: 6.1.18
What does the `//` operator do in Python, e.g. `7 // 2`?
Have a question about this video? Mention reference 6.1.18 when you contact us.
a.Comments out the rest of the line
b.Is a syntax error
c.Divides and returns a tuple of (quotient, remainder)
d.Performs floor (integer) division, discarding any remainder
`//` is floor division -- `7 // 2` evaluates to 3 (discarding the 0.5 remainder and rounding toward negative infinity), as opposed to `/`, which always returns a float (7 / 2 == 3.5).
Find this on YouTube & Instagram
Every BYTES video is tagged with its reference number and topic — search any of these on YouTube or Instagram to find this one:
#BYTES#BYTES6118#Python