Created
October 15, 2015 14:52
-
-
Save javi830810/727f8ef0fd31a77a63e5 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def pow(a,b): | |
| if b == 0: | |
| return 1 | |
| if b == 1: | |
| return a | |
| if b % 2 == 1: | |
| return pow(a,b/2)*pow(a,b/2)*a | |
| if b % 2 == 0: | |
| return pow(a,b/2)*pow(a,b/2) | |
| print pow(2,5) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment