+ 1
// and **? what does it do?
What does // and ** do in python?
2 Answers
+ 15
** Performs exponential (power) calculation on operators.
a**b = a to the power b
// is Floor Division i.e. The division of operands where the result is the quotient in which the digits after the decimal point are removed. But if one of the operands is negative, the result is floored, i.e., rounded away from zero (towards negative infinity):
9//2 = 4
-11//3 = -4
+ 1
Pyton.
// Floor division operand is very simple with positive digit. But don't mistake with negative digits!
9//4=2
11//3=3 -11//3=-4
10//3=3 -10//3=-4
10//-3=-4
9.01//3=3.0 9.01//-3=-4
9.01/3=3.00333333333334