Aside from using f-string formatting in python to get a binary string from a number, such as:
>>> "{0:>08b}".format(i)
'00001100'
What would be the simplest functional/algorithmic way to get the binary representation of a number? For example, what I'm using now is:
def number_to_binary(number, s=''):
while (number):
s = str(number % 2) + s
number = number >> 1
return s