Mercurial > louis > peeves
view misc/poweroftwo/solution.py @ 1:8f77e48d3704
Add the power of two exercise
author | Louis Opter <kalessin@kalessin.fr> |
---|---|
date | Sun, 30 Jun 2013 23:43:41 -0700 |
parents | |
children |
line wrap: on
line source
#!/usr/bin/env python def is_power_of_two(n): return n > 0 and not n & (n - 1)