Explain the //, %, and ** operators in python?



Explain the //, %, and ** operators in python?..

Answer / Shyam Veer Arya

1. Floor Division (//): This operator performs integer division. It always gives an integer as a result by rounding down the quotient towards minus infinity. For example: 7 // 3 returns 2.
2. Modulus (%): As mentioned earlier, this operator is used to get the remainder after division. For example: 7 % 3 returns 1.
3. Exponentiation (**): This operator raises a number to a power. For example: 2 ** 4 returns 16.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Python Interview Questions

Is there a reverse function in python?

1 Answers  


What is the use of assertions in python?

0 Answers  


What are classes in programming?

1 Answers  


What is the use of dir() function?

1 Answers  


What will be the output of data[-2] from the list data = [1,5,8,6,9,3,4]?

1 Answers  


What is flask used for in python?

1 Answers  


Python or r: which one would you prefer for text analytics?

1 Answers  


How do you access private methods in python?

1 Answers  


How are inheritance and overriding methods are related?

1 Answers  


What is the purpose of not in operator?

1 Answers  


What are local variables and global variables in python?

1 Answers  


What is unlink in python?

1 Answers  


Categories