Python QUESTION 2 Need a code to convert binary to decimal task is…

Question Answered step-by-step Python QUESTION 2 Need a code to convert binary to decimal task is… Python QUESTION 2 Need a code to convert binary to decimaltask is to make a function named b2d which accepts a single argument ‘n’ that represents the binary number to convert.More precisely, ‘n’ is a decimal number consisting only of 1s and 0s but are interpreted as a binary number.The b2d function should return another integer that is a decimal representation of ‘n’.n: 1101, Return value: 13n: 100, Return value: 4n: 1, Return value: 1You are not allowed to use strings and/or lists, as well as methods and functions pertaining to them.The function b2d should also handle illegal inputs appropriately, and your implementation will be graded on how the error is processed.Finally, provide a detailed documentation describing your approach.    Computer Science Engineering & Technology Python Programming CSE 101 Share QuestionEmailCopy link Comments (0)