Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Practice Ciphering | Octal 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

bookPractice Ciphering

So far so good 😉.

As you already know how to convert decimal numbers to binary, a useful step is to learn how to do the opposite action. As you get familiar with the previous steps this one is not going to be a challenge for you. 1 in binary code is still one, 0 is still zero, but here you have 8 numbers so 9 should be converted properly 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7.In the example, we define 1234 as a decimal number.

  1. You need to divide the number by 8, and take down the remainder of the division.
  2. Then you should calculate the received number and implement the first step to it.
  3. You can stop if division results in 0.
  4. Rewrite remainders in the reversed order.

As mentioned, the more practice the better. Here you are going to make a complex task where you will work not only with a list of converted numbers but with string: it means that you should not only append remainders but convert it to strings firstly. Try to do the task to see beautiful representations in string.

1234567891011121314151617181920212223242526
# Defininig the decimal number decimal_number = 4321 # Creating a list for storing the converted binary number octal_number = [ ] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # Check if the decimal number is zero: further we will convert it till the number is zero if decimal_number == 0: # 0 in the octal numeral system is the representation of 0 in decimal one, so we append 0 to the list of the octal numbers octal_number.append(str(0)) #otherwise else: # The loop executes till the number is zero while decimal_number != 0: # Counting the remainder of dividing by eight remainder = decimal_number % 8 # Appending the converted remainder for creating an octal representation octal_number.append(str(remainder)) # This operation allows to decrease number eight times and work with the integer part of new one decimal_number = decimal_number//8 # Reversing the string octal_number = octal_number[::-1] # Joining all items of the string to make it more readable octal_number = " ".join(octal_number) # Printing the result print("The number in octal numeral system is:", octal_number)
copy
Task
test

Swipe to show code editor

Write the code that will decode the number 3196 from the decimal numeral system to octal. Fill the gaps and follow the algorithm. If everything is correct you will receive another special number 🤯, the explanation is waiting for you at the end of the chapter.

  1. Define an empty list for storing the octal_number.
  2. Print the decimal_number variable.
  3. Check if the decimal_number variable is 0.
  4. Append 0 if decimal_number variable is 0.
  5. Define the loop which works while decimal number is not 0.
  6. Count the remainder of division decimal_number by 8.
  7. Append converted remainder to the list of octal numbers.
  8. Decrese decimal_number using integer division it by 8.
  9. Make the string of octal numbers reversed.

Note

I bet you've received 6174. This is a Kaprekar's and it is called after the mathematician D.R. Kaprekar.Try to do the simple calculation with a number that consists of at least two different digits: 5678 for instance. Firstly write this number in descending and ascending order and subtract it: 8765-5678 = 3087, then we will do the same, but with the number 3087 8730 - 0378 = 8352, the same here 8532 - 2358 = 6174 7641 - 1467 = 6774. You can apply the same algorithm to different numbers and you will receive 6174 every time.

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 2. Chapter 2
toggle bottom row

bookPractice Ciphering

So far so good 😉.

As you already know how to convert decimal numbers to binary, a useful step is to learn how to do the opposite action. As you get familiar with the previous steps this one is not going to be a challenge for you. 1 in binary code is still one, 0 is still zero, but here you have 8 numbers so 9 should be converted properly 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7.In the example, we define 1234 as a decimal number.

  1. You need to divide the number by 8, and take down the remainder of the division.
  2. Then you should calculate the received number and implement the first step to it.
  3. You can stop if division results in 0.
  4. Rewrite remainders in the reversed order.

As mentioned, the more practice the better. Here you are going to make a complex task where you will work not only with a list of converted numbers but with string: it means that you should not only append remainders but convert it to strings firstly. Try to do the task to see beautiful representations in string.

1234567891011121314151617181920212223242526
# Defininig the decimal number decimal_number = 4321 # Creating a list for storing the converted binary number octal_number = [ ] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # Check if the decimal number is zero: further we will convert it till the number is zero if decimal_number == 0: # 0 in the octal numeral system is the representation of 0 in decimal one, so we append 0 to the list of the octal numbers octal_number.append(str(0)) #otherwise else: # The loop executes till the number is zero while decimal_number != 0: # Counting the remainder of dividing by eight remainder = decimal_number % 8 # Appending the converted remainder for creating an octal representation octal_number.append(str(remainder)) # This operation allows to decrease number eight times and work with the integer part of new one decimal_number = decimal_number//8 # Reversing the string octal_number = octal_number[::-1] # Joining all items of the string to make it more readable octal_number = " ".join(octal_number) # Printing the result print("The number in octal numeral system is:", octal_number)
copy
Task
test

Swipe to show code editor

Write the code that will decode the number 3196 from the decimal numeral system to octal. Fill the gaps and follow the algorithm. If everything is correct you will receive another special number 🤯, the explanation is waiting for you at the end of the chapter.

  1. Define an empty list for storing the octal_number.
  2. Print the decimal_number variable.
  3. Check if the decimal_number variable is 0.
  4. Append 0 if decimal_number variable is 0.
  5. Define the loop which works while decimal number is not 0.
  6. Count the remainder of division decimal_number by 8.
  7. Append converted remainder to the list of octal numbers.
  8. Decrese decimal_number using integer division it by 8.
  9. Make the string of octal numbers reversed.

Note

I bet you've received 6174. This is a Kaprekar's and it is called after the mathematician D.R. Kaprekar.Try to do the simple calculation with a number that consists of at least two different digits: 5678 for instance. Firstly write this number in descending and ascending order and subtract it: 8765-5678 = 3087, then we will do the same, but with the number 3087 8730 - 0378 = 8352, the same here 8532 - 2358 = 6174 7641 - 1467 = 6774. You can apply the same algorithm to different numbers and you will receive 6174 every time.

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 2. Chapter 2
toggle bottom row

bookPractice Ciphering

So far so good 😉.

As you already know how to convert decimal numbers to binary, a useful step is to learn how to do the opposite action. As you get familiar with the previous steps this one is not going to be a challenge for you. 1 in binary code is still one, 0 is still zero, but here you have 8 numbers so 9 should be converted properly 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7.In the example, we define 1234 as a decimal number.

  1. You need to divide the number by 8, and take down the remainder of the division.
  2. Then you should calculate the received number and implement the first step to it.
  3. You can stop if division results in 0.
  4. Rewrite remainders in the reversed order.

As mentioned, the more practice the better. Here you are going to make a complex task where you will work not only with a list of converted numbers but with string: it means that you should not only append remainders but convert it to strings firstly. Try to do the task to see beautiful representations in string.

1234567891011121314151617181920212223242526
# Defininig the decimal number decimal_number = 4321 # Creating a list for storing the converted binary number octal_number = [ ] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # Check if the decimal number is zero: further we will convert it till the number is zero if decimal_number == 0: # 0 in the octal numeral system is the representation of 0 in decimal one, so we append 0 to the list of the octal numbers octal_number.append(str(0)) #otherwise else: # The loop executes till the number is zero while decimal_number != 0: # Counting the remainder of dividing by eight remainder = decimal_number % 8 # Appending the converted remainder for creating an octal representation octal_number.append(str(remainder)) # This operation allows to decrease number eight times and work with the integer part of new one decimal_number = decimal_number//8 # Reversing the string octal_number = octal_number[::-1] # Joining all items of the string to make it more readable octal_number = " ".join(octal_number) # Printing the result print("The number in octal numeral system is:", octal_number)
copy
Task
test

Swipe to show code editor

Write the code that will decode the number 3196 from the decimal numeral system to octal. Fill the gaps and follow the algorithm. If everything is correct you will receive another special number 🤯, the explanation is waiting for you at the end of the chapter.

  1. Define an empty list for storing the octal_number.
  2. Print the decimal_number variable.
  3. Check if the decimal_number variable is 0.
  4. Append 0 if decimal_number variable is 0.
  5. Define the loop which works while decimal number is not 0.
  6. Count the remainder of division decimal_number by 8.
  7. Append converted remainder to the list of octal numbers.
  8. Decrese decimal_number using integer division it by 8.
  9. Make the string of octal numbers reversed.

Note

I bet you've received 6174. This is a Kaprekar's and it is called after the mathematician D.R. Kaprekar.Try to do the simple calculation with a number that consists of at least two different digits: 5678 for instance. Firstly write this number in descending and ascending order and subtract it: 8765-5678 = 3087, then we will do the same, but with the number 3087 8730 - 0378 = 8352, the same here 8532 - 2358 = 6174 7641 - 1467 = 6774. You can apply the same algorithm to different numbers and you will receive 6174 every time.

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!

So far so good 😉.

As you already know how to convert decimal numbers to binary, a useful step is to learn how to do the opposite action. As you get familiar with the previous steps this one is not going to be a challenge for you. 1 in binary code is still one, 0 is still zero, but here you have 8 numbers so 9 should be converted properly 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7.In the example, we define 1234 as a decimal number.

  1. You need to divide the number by 8, and take down the remainder of the division.
  2. Then you should calculate the received number and implement the first step to it.
  3. You can stop if division results in 0.
  4. Rewrite remainders in the reversed order.

As mentioned, the more practice the better. Here you are going to make a complex task where you will work not only with a list of converted numbers but with string: it means that you should not only append remainders but convert it to strings firstly. Try to do the task to see beautiful representations in string.

1234567891011121314151617181920212223242526
# Defininig the decimal number decimal_number = 4321 # Creating a list for storing the converted binary number octal_number = [ ] # The text should be realised here due to the reason that further the decimal number will be changed print("The number in decimal numeral system is:", decimal_number) # Check if the decimal number is zero: further we will convert it till the number is zero if decimal_number == 0: # 0 in the octal numeral system is the representation of 0 in decimal one, so we append 0 to the list of the octal numbers octal_number.append(str(0)) #otherwise else: # The loop executes till the number is zero while decimal_number != 0: # Counting the remainder of dividing by eight remainder = decimal_number % 8 # Appending the converted remainder for creating an octal representation octal_number.append(str(remainder)) # This operation allows to decrease number eight times and work with the integer part of new one decimal_number = decimal_number//8 # Reversing the string octal_number = octal_number[::-1] # Joining all items of the string to make it more readable octal_number = " ".join(octal_number) # Printing the result print("The number in octal numeral system is:", octal_number)
copy
Task
test

Swipe to show code editor

Write the code that will decode the number 3196 from the decimal numeral system to octal. Fill the gaps and follow the algorithm. If everything is correct you will receive another special number 🤯, the explanation is waiting for you at the end of the chapter.

  1. Define an empty list for storing the octal_number.
  2. Print the decimal_number variable.
  3. Check if the decimal_number variable is 0.
  4. Append 0 if decimal_number variable is 0.
  5. Define the loop which works while decimal number is not 0.
  6. Count the remainder of division decimal_number by 8.
  7. Append converted remainder to the list of octal numbers.
  8. Decrese decimal_number using integer division it by 8.
  9. Make the string of octal numbers reversed.

Note

I bet you've received 6174. This is a Kaprekar's and it is called after the mathematician D.R. Kaprekar.Try to do the simple calculation with a number that consists of at least two different digits: 5678 for instance. Firstly write this number in descending and ascending order and subtract it: 8765-5678 = 3087, then we will do the same, but with the number 3087 8730 - 0378 = 8352, the same here 8532 - 2358 = 6174 7641 - 1467 = 6774. You can apply the same algorithm to different numbers and you will receive 6174 every time.

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Section 2. Chapter 2
Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt