I'm trying to take a number, convert it into binary, and then produce a list of the length of like terms.
For example, n=49 is represented in binary as "110001"
.
I would like to return a list of the length of ["11", "000", "1"]
, which is [2, 3, 1]
.
So far I'm able to convert a number into binary using "{0:b}".format(n)
but I cannot group the like terms.