Python / vs // Operator [Duplicate]

I encountered the use of // opertor in place of / in a python tutorial I was going through. What is the difference between / and // operator in Python?

0

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

9.9. operator — Standard operators as functions

Alexander Ross

Alexander Ross

Gaming, Esports & Interactive Media Writer

Alexander Ross has covered the video game industry for a decade, writing deep dives on game design, esports tournaments, VR developments, and gaming culture.

Share this article
Twitter Facebook Pinterest