[Solved] Binary to Decimal conversion in Python [closed]


int() function in Python and Python3 converts a number in given base to decimal.
So,in your code:
the first line is for asking the user whether how many binary numbers he wants to convert to decimal.
Then you are setting the range in for loop.
Then you are asking for input with base 2 to convert that to decimal and printing it.
So,proper code would be:

t=int(input("Enter how many numbers you want to convert to decimal:"))
for _ in range(t):
    n=int(input("Enter the number"),2)
    print(n) 

solved Binary to Decimal conversion in Python [closed]