I encountered the use of the //
operator in place of /
in a Python tutorial I was going through. What is the difference between the /
and //
operator in Python?
Asked
Active
Viewed 3.5k times
10

Peter Mortensen
- 30,738
- 21
- 105
- 131

Ayush
- 485
- 2
- 6
- 19
1 Answers
15
In Python 3.0 and above, check in your terminal.
a) /
operator, aka classic division
>>> 5/2
2.5
b) //
operator, aka floor division
>>> 5//2
2
Reference

Peter Mortensen
- 30,738
- 21
- 105
- 131

prayagupa
- 30,204
- 14
- 155
- 192