Write an algorithm in pseudocode or a high-level programming language (such as Python) to convert a 6-bit binary string into its denary equivalent.
The algorithm must:
- Repeatedly prompt the user to input a binary string until they enter a string that is exactly 6 characters long (you do not need to validate that it only contains '0' and '1').
- Once a valid 6-character string is input:
- Convert the binary pattern into its denary equivalent using standard positional values.
- Print a message that contains both the original binary string and the calculated denary equivalent.
- Include at least one comment explaining how the conversion process works.
| Denary placeholder | 32 | 16 | 8 | 4 | 2 | 1 |
|---|
| Binary number | 1 | 0 | 1 | 1 | 0 | 1 |
| Denary value | 32 | 0 | 8 | 4 | 0 | 1 |
32+8+4+1=45
32 + 8 + 4 + 1 = 45
32+8+4+1=45