Created
April 26, 2020 12:17
-
-
Save Billmike/98e805775ed473826c6cf2c8d5e1be8c 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 power(num, x=1): | |
result = 1 | |
for i in range(x): | |
result = result * num | |
return result | |
power(4) # 4 | |
power(4, 2) # 16 | |
power(4, 3) # 64 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment