0

In python, 15//2 will result 7.5

In python 15//2 will result 7.5

19th Aug 2024, 12:59 PM
Jayanti K parmar
Jayanti K parmar - avatar
2 Answers
+ 5
In Python, the expression 15 // 2 will result in 7, not 7.5. The // operator performs integer division, which divides the numbers and rounds the result down to the nearest whole number
19th Aug 2024, 1:10 PM
Melkon
Melkon - avatar
+ 1
In Python, `15 // 2` results in `7`. The `//` operator performs integer (floor) division, which discards the remainder and returns the largest integer less than or equal to the division result. To get a result of `7.5`, you should use the `/` operator for floating-point division.
19th Aug 2024, 10:25 PM
Gregory Bale
Gregory Bale - avatar