I want to pick a number from a given list list and extract the places of ones from n bits representation.
I know that if I want 8 bits, I need to write
r = random.choice(list)
bin = "{0:08b}".format(r)
but I want to do something like
bin = "{0:0(self.n)b}".format(r)
where n is a class member.
How do I do this?