+ 2
Guys, I wanna ask a question again, I'm still confused with this, like (2//6) how to slove and get the result for it? -> (//)
Also, give me another example of that
17 Antworten
+ 8
Givantaro Agusta It's Floor division.Hope these help you
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2273/?ref=app
https://www.sololearn.com/Discuss/827101/?ref=app
+ 8
Givantaro Agusta I'm sorry lol😅
I did this to realize the importance of using the search bar.
Let me make it easy for you👍
+ 8
Avatar Agusta Yes, of course you can if you are good at math formula😉
+ 6
꧁༒Rishabh༒꧂, I never needed THAT so far. 😂
You have a bag of size 2. How many items of size 6 go into there?
0.
+ 3
The output will be 0 because "//" gives the answer in only integers.
If you'll divide 6//2 it'll give you the result 3 as the output..
It's used just for getting the quotient. To get the result of it, you can:
print(2//6)
#or
a=2
b=6
c=2//6
print(c)
#or
a=2
b=6
print(a//b)
It's simple to get the result as output
+ 3
Simba ok, thank you! 😁 btw, can I solve that code without being typed on PC? Which means, I can solve it by my mind, if there's a way to do that, how to do that?
+ 3
If I understood your question clearly:-
Remember this:
Whichever is the numerator(upper number) in division:
It's getting divided and the denominator (lower number)
always divides the upper number.
+ 2
Givantaro Agusta just perform the normal division for example 2/6 = 0.3333. and then just remove the stuff after the decimal point so the answer would be 2//6 = 0
Let's take another example
5/2 = 2.5
Now remove the stuff after decimal
5//2 = 2
+ 2
2//6
How often does the 6 fit into the 2?
Answer: 0
+ 2
HonFu
-2 times🤔
Answer should be -2 of your question
(Logically)
Imagine virtually in a number line
+ 2
Simba should I remember all the result of that or not? Like, what's the result of, from example : 2//6, 3//2, etc? Is that necessary to remember all of those results?
+ 2
꧁༒Rishabh༒꧂ Can I solve that without IDE? which means I can solve that in without being typed the codes in my pc, if there's oneway to do that, how can I do that?
+ 1
'//'--> interger output decimal point places are removed
+ 1
I think it works like 2//6 = int(0.33)= 0 (hopefully it helps)
+ 1
2//6 means divide 2 by 6 and you dont need fractions or to divide the remainder any more
+ 1
For python / gives floats
// Gives interger decimal points removed just like / works in c and java
0
Floor division gives you the "quotient" of the division in math. However, there is still some minor differences. The returned type is "integer(int)" if both the dividend and the divisor are integers. If one of the dividend or divisor is float, it then returns float.
e.g.
6//2 #3
2//6 #0
2.0//6 #0.0
2//6.0 #0.0