From a23b2e47a73f3b42bada2d7fef3b57559504db50 Mon Sep 17 00:00:00 2001 From: nj4710 Date: Fri, 20 May 2016 09:48:23 +0530 Subject: [PATCH] Create Python-Function-POW.md (#989) * Create Python-Function-POW.md For issue #819 * Update and rename Python-Function_POW.md to Python-Function-Pow.md * Update Python-Function-Pow.md * Update Python-Function-Pow.md * Update Python-Function-Pow.md --- Python-Function-Pow.md | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Python-Function-Pow.md diff --git a/Python-Function-Pow.md b/Python-Function-Pow.md new file mode 100644 index 000000000..36fe0ea23 --- /dev/null +++ b/Python-Function-Pow.md @@ -0,0 +1,27 @@ +# Python pow(x,y) + +`pow(x, y[, z])` is a built-in function in Python 3 to calculate `x` to the power `y` and if `z` is present , returns `x` to the power `y` [modulo](https://processing.org/reference/modulo.html) `z` + +## Arguments + +The arguments must have numeric types. +This function takes two arguments, `x` and `y`, as well as three, `x`,`y` and `z`. +If `z` is present, `x` and `y` must be of integer types, and y must be non-negative. + + +## Return + +If `z` is present it returns `x` to the power `y` modulo `z`.If only `x` and `y` are present it returns `x` to the power `y` (same as x**y). + + + +## Example + +```python +print(pow(2,4)) # prints 16 +print(pow(10,-2)) # prints 0.01 +print(pow(4,3,5)) # prints 4 +``` +:rocket: [Run Code](https://repl.it/CTGi) + +[Official Documentation](https://docs.python.org/3/library/functions.html#pow)