Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Bonus 1. Write two functions one each for conversions from binary to decimal and

ID: 3750896 • Letter: B

Question

Bonus 1. Write two functions one each for conversions from binary to decimal and decimal to binary respectively. The first function should take the sequence of binary digits ...d2dido.d-1d-2... as a string - for example, '1101' and give back the decimal equivalent of the input as an output. For now, you can stick to integers. The second function should take a decimal number as input and give an output as a list containing the digits of the corresponding binary number as members of the list in the correct order. Check your answers using the built in functions available in Python that we discussed in class 2. Can you write a function that performs addition on binary numbers by accepting two binary number strings bi and b2 as input and returns the binary string b3 as output where b3-bit b2? Ex: b1-110101, and b2 1101' and b3 bi + b2 1000010'. Don't use built in typecasting and other functions in Python. Code this from scratch

Explanation / Answer

The function written in first wil be used in second part as well , please find below the code

1)

save the below code add converstion.py or any another name that end with .py

#out put

19 to binary = [1, 0, 0, 1, 1]
1111 to decimal = 15

#~~~~~~~~~~~end of part 1~~~~~~~~~~

2)save the below code as binary_addition.py or any another file end with .py

# output

addition of two binary 1111 and 1000 = 10111

Please do let me know if u have any concern...