Power function : Function Define : Function : Python examples (example source code) Organized by topic

C++
PHP
Python
Python Home »  Function   » [  Function Define  ]  Screenshots 
 



Power function




def power(x, n):
    if n == 0:
        return 1
    else:
        return x * power(x, n-1)


print power(2,7)
           
       
Related examples in the same category
1.  A function definition A function definition
2.  Define simple function in Python Define simple function in Python
3.  A function that writes the Fibonacci series to an arbitrary boundary A function that writes the Fibonacci series to an arbitrary boundary
4.  Define a function in Python Define a function in Python
5.  Factorial function Factorial function
























Home| Contact Us
Copyright 2003 - 04 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.