What is the farmula to convert 1s and 0s | Sololearn: Learn to code for FREE!
Novo curso! Todo programador deveria aprender IA generativa!
Experimente uma aula grƔtis
0

What is the farmula to convert 1s and 0s

8th May 2017, 5:37 AM
Sai Venkat
Sai Venkat - avatar
5 Respostas
+ 5
do you mean binary? that uses 1s and 0s?
8th May 2017, 5:49 AM
_Retr0/-
_Retr0/- - avatar
+ 1
what do you mean?
8th May 2017, 5:41 AM
MR Programmer
MR Programmer - avatar
+ 1
zero = !one;
8th May 2017, 5:42 AM
CalviÕ²
CalviÕ² - avatar
+ 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).
8th May 2017, 6:26 AM
Klaus-Dieter Warzecha
Klaus-Dieter Warzecha - avatar
0
yes its binery
8th May 2017, 5:58 AM
Sai Venkat
Sai Venkat - avatar