What is the output of the code print (9//2)
Answers
Answer:
The Answer to (9//2) is 4.
Explanation:
This answer seems a little strange. Well, this is actually because your head visualizes 9/2 to be 4.5. During the making of python two, it was decided that a coll feature should be added. This feature made it faster to throw away the floating-point. What is a floating-point? In easy words, a floating-point can be one of these: .5, .4, .3, .2, .1. You might be wondering, "Hey, I recognize these strange figures". Well, that's because you recognize them from numbers like 1.4 or 8.2. So, long story short, by using this '//' sign, you are basically asking python to divide 9 by 2 and telling it to throw away the floating-point which in this case is .5 (from 4.5). But, I am not entirely sure the only python has this syntax guiding this particular operation. If you want you can learn more about the syntax on your own.
Thank you, and please vote me as Brainleist.
The output of the code
print (9//2) in python language will be :
4
- In all the versions of python, the double backslash(//) operator stands for floor division operation.
- Clearly 9 divided by 2 gives 4.5
- But, in this case in floor division, the operation divides the number and rounds it off to the nearest integer lesser .
- Therefore 9//2 will give the value 4 instead of 4.5
#SPJ3