Question #565
In Python, what is the difference between '/' and '//' when used for division?
Merged questions
Answer
In Python 3.x, there are two operators for the division :

5 / 2
returns 2.5
(floating point division) 
5 // 2
returns 2
(floor or integer division)
Note that 5 // 2
returns 3
.
5 events in history
Question by Alphonsio 12/31/2020 at 06:25:16 PM
What is the difference between '/' and '//' operators in Python?
Answer by Alphonsio 12/31/2020 at 06:03:13 PM
In Python 3.x, there are two operators for the division :

5 / 2
returns 2.5
(floating point division) 
5 // 2
returns 2
(floor or integer division)
Note that 5 // 2
returns 3
.
Answer by Alphonsio 12/31/2020 at 06:02:40 PM
In Python 3.x, there are two operators for the division :

5 / 2
returns 2.5
(floating point division) 
5 // 2
returns 2
(floor or integer division)
Note that 5 // 2
returns 3
.
Answer by Alphonsio 12/31/2020 at 05:52:41 PM
In Python 3.x, there are two operators for the division :

5 / 2
will return 2.5
(floating point division) 
5 // 2
will return 2
(floor or integer division)
Question by Alphonsio 12/31/2020 at 05:49:24 PM
In Python, what is the difference between '/' and '//' when used for division?
#  ID  Query  URL  Count 

Icons proudly provided by Friconix.