One More Ciphering Challenge
I appreciate your efforts a lot! Here you are going to dive deeper into ciphering and the last issue for you is converting a number from a decimal numeral system to a hexadecimal one. Try to do it using strings😉.
- You need to divide the number by 16, and take down the remainder of the division.
- If the number is greater than 9, you need to find a match in letters.
- Then you should calculate the received number and implement the first step to it.
- You can stop if division results in 0.
- Rewrite remainders in the reversed order.
Завдання
Time to hone your skills! Follow the algorithm and fill the gaps to receive a number in hex representation:
- Print the
decimal_number
variable. - Create an empty list for storing
hexadecimal_number
. - Define the loop which executes till the
decimal_number
is0
. - Count the
remainder
of divisiondecimal_number
by16
. - Make the string
hexadecimal_number
reversed. - Join all elements of the string
hexadecimal_number
.
Все було зрозуміло?
Зміст курсу
Numeral Systems 101
2. Octal Numeral system
3. Hexadecimal Numeral system
Numeral Systems 101
One More Ciphering Challenge
I appreciate your efforts a lot! Here you are going to dive deeper into ciphering and the last issue for you is converting a number from a decimal numeral system to a hexadecimal one. Try to do it using strings😉.
- You need to divide the number by 16, and take down the remainder of the division.
- If the number is greater than 9, you need to find a match in letters.
- Then you should calculate the received number and implement the first step to it.
- You can stop if division results in 0.
- Rewrite remainders in the reversed order.
Завдання
Time to hone your skills! Follow the algorithm and fill the gaps to receive a number in hex representation:
- Print the
decimal_number
variable. - Create an empty list for storing
hexadecimal_number
. - Define the loop which executes till the
decimal_number
is0
. - Count the
remainder
of divisiondecimal_number
by16
. - Make the string
hexadecimal_number
reversed. - Join all elements of the string
hexadecimal_number
.
Все було зрозуміло?