In your code, simply remove this line as you are immediately reassigning over the functions input argument

binary = []

As a more concise alternative

def binatodeci(binary):
    return sum(val*(2**idx) for idx, val in enumerate(reversed(binary)))

Example

>>> binatodeci([1,1,0,1])
13
Answer from Cory Kramer on Stack Overflow
🌐
Wikihow
wikihow.com › computers and electronics › software › programming › how to convert from binary to decimal: 2 simple ways
How to Convert from Binary to Decimal: 2 Simple Ways
May 21, 2024 - First, ignore the decimal sign and keep dividing the number by 2 until the quotient is 0, always writing down the remainder to the right of each quotient. Write down the remainders from bottom to top of the list to make a sequence of 1s and ...
People also ask

How do you convert a negative decimal to binary?
First, ignore the decimal sign and keep dividing the number by 2 until the quotient is 0, always writing down the remainder to the right of each quotient. Write down the remainders from bottom to top of the list to make a sequence of 1s and 0s, and divide the list up into groups of 4, starting at the end. Add extra 0s to the front of the list if you have to. To convert the binary representation into a negative number, “flip” the sequence so that each 0 becomes a 1 and each 1 becomes a 0. Add 1 to the sequence to get your final answer. Remember that 1 + 1 = 10 in binary.
🌐
wikihow.com
wikihow.com › computers and electronics › software › programming › how to convert from binary to decimal: 2 simple ways
How to Convert from Binary to Decimal: 2 Simple Ways
Can you convert from binary to hexadecimal?
Yes. Binary is base 2, while hexadecimal is base 16. Hexadecimal numbers can be represented as the numbers 0-9 and the letters A-F (for numbers greater than 10). You’ll need to take a binary line of 4 numbers and multiply the numbers by 1, 2, 4, and 8, respectively, going from right to left. Add the results together to get your answer.
🌐
wikihow.com
wikihow.com › computers and electronics › software › programming › how to convert from binary to decimal: 2 simple ways
How to Convert from Binary to Decimal: 2 Simple Ways
🌐
Binarytables
binarytables.com › tables › binary-to-decimal
Binary to Decimal Table | Free Conversion Table
Our 8 bit binary to decimal table will help you convert decimal numbers from 0 to 127 to binary.
🌐
Tony's Trains
tonystrains.com › download › DCC_DecBiHex_Chart.pdf pdf
Decimal-Binary-Hexadecimal Conversion Chart
This chart shows all of the combinations of decimal, binary and hexadecimal from 0 to 255 decimal.
🌐
DPR
dpr.dc.gov › sites › default › files › dc › sites › dpr › page_content › attachments › Binary to Decimal Conversion Table.pdf pdf
Binary to Decimal Conversion Table Binary Number Decimal Number 0 0 1 1 10 2
Binary to Decimal Conversion Table · Binary · Number · Decimal · Number · 0 · 0 · 1 · 1 · 10 · 2 · 11 · 3 · 100 · 4 · 101 · 5 · 110 · 6 · 111 · 7 · 1000 · 8 ·
🌐
Cuemath
cuemath.com › numbers › binary-to-decimal
Binary to Decimal - Conversion | How to Convert Binary to Decimal?
A binary number can be converted to a decimal number by multiplying the individual digits by powers of 2 starting with 0 for the rightmost digit, then by increasing the exponents by 1 each time as we move onto the left side.
🌐
Convert Binary
convertbinary.com › home › table of binary numbers
Table / List of Binary Numbers ▶️ from 0 to 100
April 30, 2023 - In short, to convert binary numbers to decimal numbers, you have to multiply each binary digit by two to the power of its place number, from right to left, and then add all the results together.
Find elsewhere
🌐
Minus40
minus40.info › sky › binarydec.html
Conversion list for Binary and Decimal Numbers
Counting from 0 to 4000, here is a conversion list of base 2 Binary Numbers and their equivalent base 10 Decimal Numbers.
🌐
TextFixer
textfixer.com › numbers › binary-to-decimal.php
Binary to Decimal Converter | Quickly Convert Numbers
Binary to decimal converter can transform a single binary number like "1101101" to a regular base ten number like 109.
🌐
Binary Hex Decimal Converter
binaryhexconverter.com › binary-to-decimal-converter
Binary to Decimal Converter
Binary to decimal converter helps you to calculate decimal value from a binary number value up to 63 characters length, including signed two's complement results, and bin to dec conversion table.
🌐
Basic Electronics Tutorials
electronics-tutorials.ws › home › binary to decimal conversion
Binary to Decimal and How to Convert Binary to Decimal
April 18, 2026 - Binary to Decimal Conversion is a division-by-2 process of converting a Base-2 binary number consisting of 1’s and 0’s, into an equivalent Base-10 decimal number by moving left to right through the binary number.
🌐
GeeksforGeeks
geeksforgeeks.org › utilities › binary-to-decimal
Binary to Decimal Converter | Calculate Binary to Decimal online - GeeksforGeeks
February 25, 2026 - Step-1 First we need to multiply 0 with 2 and add the 1st digit in binary number. ... Step-2 Now use the result of above step and multiply with 2 and add the second digit of binary number.
🌐
Unit Converters
unitconverters.net › numbers › binary-to-decimal.htm
Convert binary to decimal
Instant free online tool for binary to decimal conversion or vice versa. The binary to decimal conversion table and conversion steps are also listed. Also, explore tools to convert binary or decimal to other numbers units or learn more about numbers conversions.
🌐
LeetCode
leetcode.com › problems › convert-binary-number-in-a-linked-list-to-integer
Convert Binary Number in a Linked List to Integer - LeetCode
Convert Binary Number in a Linked ... 1. The linked list holds the binary representation of a number. Return the decimal value of the number in the linked list....
🌐
Teleport
goteleport.com › home › resources › tools › binary to decimal converter | instantly convert binary to decimal
Binary to Decimal Converter | Instantly Convert Binary to Decimal | Teleport
Converting binary to decimal is a fairly straightforward process. Let's break it down using the binary number 1011 as an example: Write the Binary Number: Begin by writing down the binary number you want to convert (e.g., 1011). List the Powers of 2: From right to left, list the powers of 2, starting with 2^0, corresponding to each digit in the binary number:
🌐
BYJUS
byjus.com › maths › binary-to-decimal-conversion
Binary to Decimal Conversion
November 22, 2021 - In the decimal number system, the positions continuous to the left of the decimal point represent units, tens, hundreds, thousands and so on. Thus, the base of the decimal number system is 10. Binary to decimal conversion is done to convert a number in a binary number system (base-2) to a number in a decimal number system (base-10).
🌐
OpenReplay
openreplay.com › home › developer toolbox › binary to decimal converter
Binary to decimal converter | OpenReplay
Convert binary numbers to decimal instantly, with unsigned or signed (two's complement) interpretation and selectable bit width.
🌐
Stanford University
stanford.edu › ~cgregg › 107-Reader › float › convert.html
Binary / Decimal Converter
This web page converts between binary and decimal numbers. For example, it will convert a binary number in the form of yyy.xxxxxxxxxxxxxxxxxxxxxxx to its decimal equivalent.
🌐
Exploring Binary
exploringbinary.com › home › decimal/binary conversion table
Decimal/Binary Conversion Table - Exploring Binary
June 2, 2018 - Here is a table you can use to convert small integers — integers between 0 and 255 — directly between decimal and binary (as an alternative to using a decimal/binary converter):