+ 1

How to convert 2 type of biner

input : (first biner) (second biner) output : a new string that is sum of both biner input : 1111111111111111 1010 output : 10000000000001001

10th Oct 2017, 7:29 PM
D' Ravelens
D' Ravelens - avatar
1 Odpowiedź
+ 8
Try like this: a = int(input("First binary number: "), 2) b = int(input("Second binary number: "), 2) print("Outcome (in a binary format): ", bin(a+b)) print("Which translates into: {}+{}={}".format(a, b, a+b)) https://code.sololearn.com/cYGrNro5F0rG/?ref=app
10th Oct 2017, 9:35 PM
Kuba Siekierzyński
Kuba Siekierzyński - avatar