Skip to content

Instantly share code, notes, and snippets.

@Billmike
Created April 26, 2020 12:17
Show Gist options
  • Save Billmike/98e805775ed473826c6cf2c8d5e1be8c to your computer and use it in GitHub Desktop.
Save Billmike/98e805775ed473826c6cf2c8d5e1be8c to your computer and use it in GitHub Desktop.
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