0

how can i mutiple two binary numbers?is there any functions for that in py?

20th May 2020, 1:58 AM
mahsa
mahsa - avatar
6 Respuestas
+ 2
The meaning of base is the weight you have to assign to your digits. For example: print(int('1101',2)) gives you 13, because 1*2**0 + 0*2**1 + 1*2**2 + 1*2**3 is 13 but print(int('1101',8)) gives 577, because 1*8**0 + 0*8**1 + 1*8**2 + 1*8**3 is 577
20th May 2020, 3:47 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 1
mahsa plz visit it https://stackoverflow.com/questions/36433448/JUMP_LINK__&&__python__&&__JUMP_LINK-binary-multiplication-algorithm You can do 1 thing in my opinion convert both Binary Numbers in decimal Numbers & multiply them & again convert the product in binary form
20th May 2020, 3:07 AM
Prince Kumar
Prince Kumar - avatar
+ 1
If your input are two strings, for example a='1101' and b='10' just print(int(a,2) * int(b,2))
20th May 2020, 3:34 AM
Bilbo Baggins
Bilbo Baggins - avatar
+ 1
mahsa It's the base of the binary number
20th May 2020, 3:37 AM
Prince Kumar
Prince Kumar - avatar
0
Bilbo Baggins thanks a lot...but why i must use 2??what does it work?
20th May 2020, 3:36 AM
mahsa
mahsa - avatar
20th May 2020, 3:39 AM
mahsa
mahsa - avatar