Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Deciphering Challenge | Hexadecimal Numeral system
Numeral Systems 101
course content

Зміст курсу

Numeral Systems 101

Numeral Systems 101

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

bookDeciphering Challenge

There is another commonly used numeral system called hexadecimal. If you learn web programming or something related to that, you should come across RGB Color Codes Chart that is implemented using hex(hexadecimal system) to help computers define different colors. Red -> #FF0000 White->#FFFFFF Yellow->#FFFF00 and the same representation for each color.

Hex is a representation of 4 bits. Computer professionals even consider reading the hexadecimal number easier than decimal one and binary. As I said previously it is a beautiful way of storing data not in a binary way, but to group it; hence, hexadecimal numerical system is implemented.

This one consists of 16 digits, 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7 8->8 9->9. I suppose you start guessing the outcome of this sequence and involve 10 as the 10th number of this continuity, but you will be taken aback because 10->A 11->B 12->C 13->D 14->E 15->F But to convert it to decimal one, you should identify the dictionary, due to the reason that dictionaries are a superior way to hold information with a key. In the previous steps all of the keys conformed to numbers, but here due to the letters dictionary should be implemented.

Rule

I reckon that you are familiar with different algorithms so it seems to me that you can guess that here(in the hexadecimal numeral system) we are going to multiply each digit by 16 raised to the power of index. Obviously, we can not multiply the letter; therefore, we should find the math for it. For instance ABC10-> (A)10x16^4+(B)11x16^3+(C)12x16^2+1x16^1+0x16^0=655360+45056+3072+16+0=703504

123456789101112131415161718192021222324
# Implementing the dictionary dictionary = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "A": 10 , "B": 11, "C": 12, "D": 13, "E": 14, "F": 15} # Definig hexadecimal number hexadecimal_number = "ABC10" # The text should be realised here due to the reason that further the binary number will be changed print("The number in hexadecimal numeral system is:", hexadecimal_number) # Definig decimal number decimal_number = 0 # Define variable for storing the power power = 0 #the loop will iterate through the string hexadecimal_number for digit in hexadecimal_number: # Taking the very last character digit = hexadecimal_number[-1] # Multyplying the last digit to 16 raised the relevant power result = dictionary[digit] * pow(16, power) # Adding result to the decimal number decimal_number = decimal_number+result # Increasing power by 1 power = power + 1 # Removing the last sharacter of the string hexadecimal_number = hexadecimal_number[0:-1] # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Завдання

I appreciate your desire to study, way to go! Write the code that will decode the number 'CAFE' from the hex numeral system to decimal. Follow this algorithm:

  1. Print the hexadecimal number.
  2. Assign 0 to the decimal_number variable.
  3. Define the variable power for storing the power and assign 0 to it.
  4. Define the loop which iterates through the hexadecimal_number string.
  5. Get the very last character of hexadecimal_number string.
  6. Raise 16 to the relevant power and multiply it by the digit.
  7. Increase power by 1.
  8. Remove the last character of the string hexadecimal_number.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 1
toggle bottom row

bookDeciphering Challenge

There is another commonly used numeral system called hexadecimal. If you learn web programming or something related to that, you should come across RGB Color Codes Chart that is implemented using hex(hexadecimal system) to help computers define different colors. Red -> #FF0000 White->#FFFFFF Yellow->#FFFF00 and the same representation for each color.

Hex is a representation of 4 bits. Computer professionals even consider reading the hexadecimal number easier than decimal one and binary. As I said previously it is a beautiful way of storing data not in a binary way, but to group it; hence, hexadecimal numerical system is implemented.

This one consists of 16 digits, 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7 8->8 9->9. I suppose you start guessing the outcome of this sequence and involve 10 as the 10th number of this continuity, but you will be taken aback because 10->A 11->B 12->C 13->D 14->E 15->F But to convert it to decimal one, you should identify the dictionary, due to the reason that dictionaries are a superior way to hold information with a key. In the previous steps all of the keys conformed to numbers, but here due to the letters dictionary should be implemented.

Rule

I reckon that you are familiar with different algorithms so it seems to me that you can guess that here(in the hexadecimal numeral system) we are going to multiply each digit by 16 raised to the power of index. Obviously, we can not multiply the letter; therefore, we should find the math for it. For instance ABC10-> (A)10x16^4+(B)11x16^3+(C)12x16^2+1x16^1+0x16^0=655360+45056+3072+16+0=703504

123456789101112131415161718192021222324
# Implementing the dictionary dictionary = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "A": 10 , "B": 11, "C": 12, "D": 13, "E": 14, "F": 15} # Definig hexadecimal number hexadecimal_number = "ABC10" # The text should be realised here due to the reason that further the binary number will be changed print("The number in hexadecimal numeral system is:", hexadecimal_number) # Definig decimal number decimal_number = 0 # Define variable for storing the power power = 0 #the loop will iterate through the string hexadecimal_number for digit in hexadecimal_number: # Taking the very last character digit = hexadecimal_number[-1] # Multyplying the last digit to 16 raised the relevant power result = dictionary[digit] * pow(16, power) # Adding result to the decimal number decimal_number = decimal_number+result # Increasing power by 1 power = power + 1 # Removing the last sharacter of the string hexadecimal_number = hexadecimal_number[0:-1] # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Завдання

I appreciate your desire to study, way to go! Write the code that will decode the number 'CAFE' from the hex numeral system to decimal. Follow this algorithm:

  1. Print the hexadecimal number.
  2. Assign 0 to the decimal_number variable.
  3. Define the variable power for storing the power and assign 0 to it.
  4. Define the loop which iterates through the hexadecimal_number string.
  5. Get the very last character of hexadecimal_number string.
  6. Raise 16 to the relevant power and multiply it by the digit.
  7. Increase power by 1.
  8. Remove the last character of the string hexadecimal_number.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 1
toggle bottom row

bookDeciphering Challenge

There is another commonly used numeral system called hexadecimal. If you learn web programming or something related to that, you should come across RGB Color Codes Chart that is implemented using hex(hexadecimal system) to help computers define different colors. Red -> #FF0000 White->#FFFFFF Yellow->#FFFF00 and the same representation for each color.

Hex is a representation of 4 bits. Computer professionals even consider reading the hexadecimal number easier than decimal one and binary. As I said previously it is a beautiful way of storing data not in a binary way, but to group it; hence, hexadecimal numerical system is implemented.

This one consists of 16 digits, 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7 8->8 9->9. I suppose you start guessing the outcome of this sequence and involve 10 as the 10th number of this continuity, but you will be taken aback because 10->A 11->B 12->C 13->D 14->E 15->F But to convert it to decimal one, you should identify the dictionary, due to the reason that dictionaries are a superior way to hold information with a key. In the previous steps all of the keys conformed to numbers, but here due to the letters dictionary should be implemented.

Rule

I reckon that you are familiar with different algorithms so it seems to me that you can guess that here(in the hexadecimal numeral system) we are going to multiply each digit by 16 raised to the power of index. Obviously, we can not multiply the letter; therefore, we should find the math for it. For instance ABC10-> (A)10x16^4+(B)11x16^3+(C)12x16^2+1x16^1+0x16^0=655360+45056+3072+16+0=703504

123456789101112131415161718192021222324
# Implementing the dictionary dictionary = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "A": 10 , "B": 11, "C": 12, "D": 13, "E": 14, "F": 15} # Definig hexadecimal number hexadecimal_number = "ABC10" # The text should be realised here due to the reason that further the binary number will be changed print("The number in hexadecimal numeral system is:", hexadecimal_number) # Definig decimal number decimal_number = 0 # Define variable for storing the power power = 0 #the loop will iterate through the string hexadecimal_number for digit in hexadecimal_number: # Taking the very last character digit = hexadecimal_number[-1] # Multyplying the last digit to 16 raised the relevant power result = dictionary[digit] * pow(16, power) # Adding result to the decimal number decimal_number = decimal_number+result # Increasing power by 1 power = power + 1 # Removing the last sharacter of the string hexadecimal_number = hexadecimal_number[0:-1] # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Завдання

I appreciate your desire to study, way to go! Write the code that will decode the number 'CAFE' from the hex numeral system to decimal. Follow this algorithm:

  1. Print the hexadecimal number.
  2. Assign 0 to the decimal_number variable.
  3. Define the variable power for storing the power and assign 0 to it.
  4. Define the loop which iterates through the hexadecimal_number string.
  5. Get the very last character of hexadecimal_number string.
  6. Raise 16 to the relevant power and multiply it by the digit.
  7. Increase power by 1.
  8. Remove the last character of the string hexadecimal_number.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

There is another commonly used numeral system called hexadecimal. If you learn web programming or something related to that, you should come across RGB Color Codes Chart that is implemented using hex(hexadecimal system) to help computers define different colors. Red -> #FF0000 White->#FFFFFF Yellow->#FFFF00 and the same representation for each color.

Hex is a representation of 4 bits. Computer professionals even consider reading the hexadecimal number easier than decimal one and binary. As I said previously it is a beautiful way of storing data not in a binary way, but to group it; hence, hexadecimal numerical system is implemented.

This one consists of 16 digits, 0->0 1->1 2->2 3->3 4->4 5->5 6->6 7->7 8->8 9->9. I suppose you start guessing the outcome of this sequence and involve 10 as the 10th number of this continuity, but you will be taken aback because 10->A 11->B 12->C 13->D 14->E 15->F But to convert it to decimal one, you should identify the dictionary, due to the reason that dictionaries are a superior way to hold information with a key. In the previous steps all of the keys conformed to numbers, but here due to the letters dictionary should be implemented.

Rule

I reckon that you are familiar with different algorithms so it seems to me that you can guess that here(in the hexadecimal numeral system) we are going to multiply each digit by 16 raised to the power of index. Obviously, we can not multiply the letter; therefore, we should find the math for it. For instance ABC10-> (A)10x16^4+(B)11x16^3+(C)12x16^2+1x16^1+0x16^0=655360+45056+3072+16+0=703504

123456789101112131415161718192021222324
# Implementing the dictionary dictionary = {"0": 0, "1": 1, "2": 2, "3": 3, "4": 4, "5": 5, "6": 6, "7": 7, "8": 8, "9": 9, "A": 10 , "B": 11, "C": 12, "D": 13, "E": 14, "F": 15} # Definig hexadecimal number hexadecimal_number = "ABC10" # The text should be realised here due to the reason that further the binary number will be changed print("The number in hexadecimal numeral system is:", hexadecimal_number) # Definig decimal number decimal_number = 0 # Define variable for storing the power power = 0 #the loop will iterate through the string hexadecimal_number for digit in hexadecimal_number: # Taking the very last character digit = hexadecimal_number[-1] # Multyplying the last digit to 16 raised the relevant power result = dictionary[digit] * pow(16, power) # Adding result to the decimal number decimal_number = decimal_number+result # Increasing power by 1 power = power + 1 # Removing the last sharacter of the string hexadecimal_number = hexadecimal_number[0:-1] # Printing the result print("The number in decimal numeral system is:", decimal_number)
copy

Завдання

I appreciate your desire to study, way to go! Write the code that will decode the number 'CAFE' from the hex numeral system to decimal. Follow this algorithm:

  1. Print the hexadecimal number.
  2. Assign 0 to the decimal_number variable.
  3. Define the variable power for storing the power and assign 0 to it.
  4. Define the loop which iterates through the hexadecimal_number string.
  5. Get the very last character of hexadecimal_number string.
  6. Raise 16 to the relevant power and multiply it by the digit.
  7. Increase power by 1.
  8. Remove the last character of the string hexadecimal_number.

Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
Секція 3. Розділ 1
Switch to desktopПерейдіть на комп'ютер для реальної практикиПродовжуйте з того місця, де ви зупинились, використовуючи один з наведених нижче варіантів
some-alt