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.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/1c2703c3-18f8-40ee-b1b8-692318d5d529/c_5.png)
Task
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
.
Everything was clear?
Course Content
Numeral Systems 101
Numeral Systems 101
2. Octal Numeral system
3. Hexadecimal Numeral system
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.
![](https://codefinity-content-media.s3.eu-west-1.amazonaws.com/1c2703c3-18f8-40ee-b1b8-692318d5d529/c_5.png)
Task
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
.
Everything was clear?