Question: Write a recursive method that parses a positive binary number as a string into a decimal integer. //Assume the input is always digit only. //If
Write a recursive method that parses a positive binary number as a string into a decimal integer.
//Assume the input is always digit only.
//If the input is not a binary number, return the same number in the integer format
Sample Input1 //A binary input
11
Sample Output1
3
Sample Input2 //Not a binary input
00112
Sample Output2
112
Step by Step Solution
3.52 Rating (155 Votes )
There are 3 Steps involved in it
def binarytodecimalbinarystr Base case if the input is not a binary number return the intege... View full answer
Get step-by-step solutions from verified subject matter experts
