From 9d184f944a7acc03ba5f7a14136939cfc669d4b7 Mon Sep 17 00:00:00 2001 From: nj4710 Date: Thu, 19 May 2016 21:26:30 +0530 Subject: [PATCH] Create Python-Function-POW.md For issue #819 --- Python-Function_POW.md | 21 +++++++++++++++++++++ 1 file changed, 21 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..d7bc4965c --- /dev/null +++ b/Python-Function_POW.md @@ -0,0 +1,21 @@ +# 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 + +#Argument +The arguments must have numeric types. +It takes two argument 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). +It is much faster than x**y % z. + + +##Code Sample +print(pow(2,4)) # prints 16 +print(pow(10,-2)) # prints 0.01 +print(pow(4,3,5)) #prints 4 + +[official docs]https://docs.python.org/3/library/functions.html#pow