Question: use Python: def addBinary (first, second): # ADD YOUR CODE HERE return None # CHANGE OR MODIFY THIS LINE # ADD YOUR CODE HERE FOR
use Python:



def addBinary (first, second): # ADD YOUR CODE HERE return None # CHANGE OR MODIFY THIS LINE # ADD YOUR CODE HERE FOR THE TwosComplement CLASS # ADD YOUR TEST CODE HER
1. Binary Addition (3 points) Addition is a common arithmetic operation, and it can be performed on numbers in any base. In fact, binary addition is simpler than base 10 addition because there are fewer rules. Like base 10 addition, binary addition works from right-to-left, adding one pair or column of digits at a time, according to the following rules: 0 0-0 0 1 1 1 0-1 1 1 0, plus a carry bit of 1 (for the next column) 1 1 2, and 2 is 10 in binary If you have three 1s to add (1 1, plus a carry bit of 1 from the previous column), the sum is 1, with a carry bit of 1 (1 1 1 33, and 3 is 11 in binary). For example, consider the following addition problem (11 11, in base 10): 1011 +1011 We start by adding the rightmost column. 1 plus 1 gives us 0, plus a carry bit of 1 1011 +1011 The second column has two 1s, plus a carry bit of 1. 1 1 1 equals 1, plus a(nother) carry bit of 1 1011 +1011 10
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
