Question: write a function that adds two binary numbers that are entered by the user. You may represent each binary number as a string of 0's

write a function that adds two binary numbers that are entered by the user.  You may represent each binary number as a string of 0's and 1's. Remember that the calculations need to start at the end of the strings.  for binary numbers of different lengths, you may pad the shorter number with 0's in front.  Also, make sure that the carry bit is implemented properly.  For example, the solution of 1+1=10

Step by Step Solution

3.33 Rating (147 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Heres the function that adds two binary numbers entered by the user Python def addbinarybinary1 binary2 Pad the shorter number with 0s in front if lenbinary1 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!