Power of Two

Published by Helen Yu in

Write a function that returns true if an integer can be expressed as a power of base value 2 and false otherwise.

Examples

power_of_two(32) ➞ true

power_of_two(1) ➞ true

power_of_two(18) ➞ false

Notes

N/A

Watch a quick demo on how Edabit works.