Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Get Acquainted with Binary Code | Binary Numeral System
Numeral Systems 101
course content

Course Content

Numeral Systems 101

Numeral Systems 101

1. Binary Numeral System
2. Octal Numeral system
3. Hexadecimal Numeral system
4. Revelation

bookGet Acquainted with Binary Code

I guess you got wind of the fact that computers see your code differently than you: this bright machine can read binary code, which consists of 0 and 1. The binary code looks like this 00011100, but zeros in forwarding positions are optional, so you can remove it and write the code like 11100. It is easy for a computer, but a challenge for humans; therefore, you are going to get familiar with deciphering it:

Rule

Here you should do the same operations as in the previous chapter. Find the index of a number(it still begins from the right ) and then multiply the current number by 2 raised to the power of the index. For instance 101->1x2^2 + 0x2^1 + 1x2^0 = 4 + 0 + 1 = 5.

Usage of binary system

The main point of using binary code is that a computer consists of billion transistors that respond to binary signals 0 or 1; hence, "computer words" that include only 0 and 1 send signals to transistors, 1 means on, and 0 means off.

12345678910111213141516171819202122
# Defining binary number binary_number = 1010111 #creating a variable for storing the converted decimal number decimal_number = 0 # The text should be realised here due to the reason that further the binary number will be changed print("The number in binary numeral system is:", binary_number) # Variable for storing the power power = 0 # The loop executes till the number is zero while binary_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = binary_number % 10 # Multiplying digit by 2 raised to the relevant power result = last_digit * pow(2, power) # Adding the result to the current decimal number receive the decimal one decimal_number = decimal_number + result # Decreasing decimal number using integer division by 10, allows getting rid of the last digit binary_number = binary_number // 10 # Increasing power by 1 power = power + 1 # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Task

It's time to hone in on your skills! Convert a number from binary numeral system to decimal one and print the result. You should follow the algorithm on the right and fill the gaps. As the result, you will receive one of the magic numbers. But the explanation is waiting for you at the end of the chapter.

  1. Define the variable power and assign 0 to it.
  2. Count the remainder of division binary_number by 10.
  3. Multiply last_digit by the 2 raised to the relevant power.
  4. Add the result to a decimal number.
  5. Increase power by 1.
  6. Print the decimal_number.

Note

I guess that you received 1729 and want to know why I claimed that this number is magic? Everything is completely clear: It is called Hardy-Ramanujan number after an anecdote about one of British mathematician G.H Hardly. If you find this information gripping you can read about the anecdote in 'The Man Who Knew Infinity by Robert Knaigel. It is the smallest number that you can express like the sum of two different cubes in two different ways. 1729 can be calculated as the sum of the cubes of 10 and 9, a cube of 10 is 1000 also the cube of 9 is 729, and the sum of the cubes of 12 and 1.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
toggle bottom row

bookGet Acquainted with Binary Code

I guess you got wind of the fact that computers see your code differently than you: this bright machine can read binary code, which consists of 0 and 1. The binary code looks like this 00011100, but zeros in forwarding positions are optional, so you can remove it and write the code like 11100. It is easy for a computer, but a challenge for humans; therefore, you are going to get familiar with deciphering it:

Rule

Here you should do the same operations as in the previous chapter. Find the index of a number(it still begins from the right ) and then multiply the current number by 2 raised to the power of the index. For instance 101->1x2^2 + 0x2^1 + 1x2^0 = 4 + 0 + 1 = 5.

Usage of binary system

The main point of using binary code is that a computer consists of billion transistors that respond to binary signals 0 or 1; hence, "computer words" that include only 0 and 1 send signals to transistors, 1 means on, and 0 means off.

12345678910111213141516171819202122
# Defining binary number binary_number = 1010111 #creating a variable for storing the converted decimal number decimal_number = 0 # The text should be realised here due to the reason that further the binary number will be changed print("The number in binary numeral system is:", binary_number) # Variable for storing the power power = 0 # The loop executes till the number is zero while binary_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = binary_number % 10 # Multiplying digit by 2 raised to the relevant power result = last_digit * pow(2, power) # Adding the result to the current decimal number receive the decimal one decimal_number = decimal_number + result # Decreasing decimal number using integer division by 10, allows getting rid of the last digit binary_number = binary_number // 10 # Increasing power by 1 power = power + 1 # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Task

It's time to hone in on your skills! Convert a number from binary numeral system to decimal one and print the result. You should follow the algorithm on the right and fill the gaps. As the result, you will receive one of the magic numbers. But the explanation is waiting for you at the end of the chapter.

  1. Define the variable power and assign 0 to it.
  2. Count the remainder of division binary_number by 10.
  3. Multiply last_digit by the 2 raised to the relevant power.
  4. Add the result to a decimal number.
  5. Increase power by 1.
  6. Print the decimal_number.

Note

I guess that you received 1729 and want to know why I claimed that this number is magic? Everything is completely clear: It is called Hardy-Ramanujan number after an anecdote about one of British mathematician G.H Hardly. If you find this information gripping you can read about the anecdote in 'The Man Who Knew Infinity by Robert Knaigel. It is the smallest number that you can express like the sum of two different cubes in two different ways. 1729 can be calculated as the sum of the cubes of 10 and 9, a cube of 10 is 1000 also the cube of 9 is 729, and the sum of the cubes of 12 and 1.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 1. Chapter 2
toggle bottom row

bookGet Acquainted with Binary Code

I guess you got wind of the fact that computers see your code differently than you: this bright machine can read binary code, which consists of 0 and 1. The binary code looks like this 00011100, but zeros in forwarding positions are optional, so you can remove it and write the code like 11100. It is easy for a computer, but a challenge for humans; therefore, you are going to get familiar with deciphering it:

Rule

Here you should do the same operations as in the previous chapter. Find the index of a number(it still begins from the right ) and then multiply the current number by 2 raised to the power of the index. For instance 101->1x2^2 + 0x2^1 + 1x2^0 = 4 + 0 + 1 = 5.

Usage of binary system

The main point of using binary code is that a computer consists of billion transistors that respond to binary signals 0 or 1; hence, "computer words" that include only 0 and 1 send signals to transistors, 1 means on, and 0 means off.

12345678910111213141516171819202122
# Defining binary number binary_number = 1010111 #creating a variable for storing the converted decimal number decimal_number = 0 # The text should be realised here due to the reason that further the binary number will be changed print("The number in binary numeral system is:", binary_number) # Variable for storing the power power = 0 # The loop executes till the number is zero while binary_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = binary_number % 10 # Multiplying digit by 2 raised to the relevant power result = last_digit * pow(2, power) # Adding the result to the current decimal number receive the decimal one decimal_number = decimal_number + result # Decreasing decimal number using integer division by 10, allows getting rid of the last digit binary_number = binary_number // 10 # Increasing power by 1 power = power + 1 # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Task

It's time to hone in on your skills! Convert a number from binary numeral system to decimal one and print the result. You should follow the algorithm on the right and fill the gaps. As the result, you will receive one of the magic numbers. But the explanation is waiting for you at the end of the chapter.

  1. Define the variable power and assign 0 to it.
  2. Count the remainder of division binary_number by 10.
  3. Multiply last_digit by the 2 raised to the relevant power.
  4. Add the result to a decimal number.
  5. Increase power by 1.
  6. Print the decimal_number.

Note

I guess that you received 1729 and want to know why I claimed that this number is magic? Everything is completely clear: It is called Hardy-Ramanujan number after an anecdote about one of British mathematician G.H Hardly. If you find this information gripping you can read about the anecdote in 'The Man Who Knew Infinity by Robert Knaigel. It is the smallest number that you can express like the sum of two different cubes in two different ways. 1729 can be calculated as the sum of the cubes of 10 and 9, a cube of 10 is 1000 also the cube of 9 is 729, and the sum of the cubes of 12 and 1.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

I guess you got wind of the fact that computers see your code differently than you: this bright machine can read binary code, which consists of 0 and 1. The binary code looks like this 00011100, but zeros in forwarding positions are optional, so you can remove it and write the code like 11100. It is easy for a computer, but a challenge for humans; therefore, you are going to get familiar with deciphering it:

Rule

Here you should do the same operations as in the previous chapter. Find the index of a number(it still begins from the right ) and then multiply the current number by 2 raised to the power of the index. For instance 101->1x2^2 + 0x2^1 + 1x2^0 = 4 + 0 + 1 = 5.

Usage of binary system

The main point of using binary code is that a computer consists of billion transistors that respond to binary signals 0 or 1; hence, "computer words" that include only 0 and 1 send signals to transistors, 1 means on, and 0 means off.

12345678910111213141516171819202122
# Defining binary number binary_number = 1010111 #creating a variable for storing the converted decimal number decimal_number = 0 # The text should be realised here due to the reason that further the binary number will be changed print("The number in binary numeral system is:", binary_number) # Variable for storing the power power = 0 # The loop executes till the number is zero while binary_number != 0: # The remainder of division by 10 allows us to receive the last digit of a number last_digit = binary_number % 10 # Multiplying digit by 2 raised to the relevant power result = last_digit * pow(2, power) # Adding the result to the current decimal number receive the decimal one decimal_number = decimal_number + result # Decreasing decimal number using integer division by 10, allows getting rid of the last digit binary_number = binary_number // 10 # Increasing power by 1 power = power + 1 # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Task

It's time to hone in on your skills! Convert a number from binary numeral system to decimal one and print the result. You should follow the algorithm on the right and fill the gaps. As the result, you will receive one of the magic numbers. But the explanation is waiting for you at the end of the chapter.

  1. Define the variable power and assign 0 to it.
  2. Count the remainder of division binary_number by 10.
  3. Multiply last_digit by the 2 raised to the relevant power.
  4. Add the result to a decimal number.
  5. Increase power by 1.
  6. Print the decimal_number.

Note

I guess that you received 1729 and want to know why I claimed that this number is magic? Everything is completely clear: It is called Hardy-Ramanujan number after an anecdote about one of British mathematician G.H Hardly. If you find this information gripping you can read about the anecdote in 'The Man Who Knew Infinity by Robert Knaigel. It is the smallest number that you can express like the sum of two different cubes in two different ways. 1729 can be calculated as the sum of the cubes of 10 and 9, a cube of 10 is 1000 also the cube of 9 is 729, and the sum of the cubes of 12 and 1.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 1. Chapter 2
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
some-alt