Created
February 6, 2017 23:21
-
-
Save shamikalashawn/1574bff3aa63f2dbcd90dcc3a7a9bb05 to your computer and use it in GitHub Desktop.
The number entered is the exponent for the power of 2.
This file contains 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 powers_of_two(power): | |
num = 1 | |
if power == 0: | |
return 1 | |
elif power > 0: | |
for x in range(1,power+1): | |
num *= 2 | |
return num |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment