Binary To Decimal

Uses

LED Display

Description

In this challenge you will use your micro:bit to convert a binary number to a decimal.

../../_images/binary-to-decimal.png

In mathematics and digital electronics, a binary number is a number expressed in the base-2 numeral system or binary numeral system, which uses only two symbols: typically 0 (zero) and 1 (one). The base-2 numeral system is a positional notation with a radix of 2. Each digit is referred to as a bit.

Basic Task

  1. Create a binary number and store to a list.
  2. Use for loop to iterate through the list. Use len() for the range.
  3. Use pop() to extract the last value on the list and convert it to a decimal value. Last value will have a value of 1 (2^0), then 2nd to the last will have a value of 2``(2^1)``, the 3rd to the last will have a value on 4 (2^2) etc.
  4. Display the result on the LED screen.