Question: 12. Write Python code that takes a number in base 2 as a string and converts it into a number in base 10. The
12. Write Python code that takes a number in base 2 as a string and converts it into a number in base 10. The name of the function is convert. Here is the output: 1 def convert(xstring): 2 #TO DO: Implement Function 3 4 numbers = ["1", "101", "1111", "10101"] 5 6 7 6 for i in numbers: print (convert(i)) 1 5 15 21 12
Step by Step Solution
There are 3 Steps involved in it
def convertxstring decimalnum 0 power ... View full answer
Get step-by-step solutions from verified subject matter experts
