0
What is the farmula to convert 1s and 0s
5 Antworten
+ 5
do you mean binary? that uses 1s and 0s?
+ 1
what do you mean?
+ 1
zero = !one;
+ 1
In Python, you can convert an int to its binary string representation using format.
number = 42
binary = format(number, 'b') # b indicates binary
print(binary) # gives '101010'
Note that the resulting string of 0 and 1 is not zero-padded to the length of full bytes.
On the binary string, you could then perform replacements (0 -> 1, 1 -> 0).
0
yes its binery