4 Respuestas
+ 2
Need not to be..
+ 2
Floor division - // will not have decimal part. It is also called Integer Division.
0
Yes, but I think it is a feature.
If you do
numb= 3
# which is type int
divisor = 2
# type is also int
print(numb/divisor)
Result is
>>>1.5
# is float
The true result is type float.
if you do
numb = 3
# which is type int
divi = 2
# type is also int
print(int(numb/divi))
Result is
>>>1
with int(somenumber)
you
convert it (and force it) to int
But the result is false.
You can force a int, but the price is a false result.
If you do nothing, Python do this step (convert into float) for you.
If you do
numb= 2
# which is type int
divis= 2
print(numb/divis)
Result is float
1.0
# type is float
0
https://code.sololearn.com/cN64fQoszouP/#cpp
Support my code about maths here, please upvote