Skip to content

Commit 9e67247

Browse files
authored
Add files via upload
1 parent 7c30a6d commit 9e67247

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

Diff for: Power_of_2_or_not.py

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
def test(n):
2+
return n>0 and (n&(n-1)==0)
3+
4+
def main():
5+
6+
n = int(input("Number: "))
7+
if test(n):
8+
print("Yes, it's a power of two!")
9+
else:
10+
print("Nah, it's not a power of two")
11+
12+
if __name__ == "__main__":
13+
14+
main()

0 commit comments

Comments
 (0)