Harder Converting
You know a lot now! You can convert a lot of numbers from different numeral systems, but here we are going to dive deeper into built-in python functions for converting. Let's start with converting to a decimal one. Here is the function int() is useful.
For instance, to convert binary numbers to decimal representation you should start with 0b. Like int(0b10011010010), where 10011010010 number should be converted.
To do the same with the octal numeral system you have to use similar syntax int(0o2322) where 2322 should be converted.
I suppose you guessed the syntax for converting from a hexadecimal numeral system: int(0X4D2), where 4D2 number should be converted.
decimal_number1 = int(0b10011010010)
decimal_number2 = int(0o2322)
decimal_number3 = int(0X4D2)
It can be implemented not only with int(), such syntax is available for other numeral systems too:
# Сonverting from binary numeral system to the octal
oct(0b1010)
# Сonverting from octal numeral system to the hexadecimal
hex(0o237)
# Сonverting from hexadecimal numeral system to the binary
bin(0x8ea)
Swipe to start coding
I wish you good luck with this task, please follow the algorithm:
- Convert number 
4EAFfrom the hexadecimal numeral system to the octal. - Convert number 
2547from the octal numeral system to the binary. - Convert number 
1101011from the binary numeral system to the decimal. - Convert number 
2001from the decimal numeral system to the hexadecimal. 
Solution
Merci pour vos commentaires !
single
Demandez à l'IA
Demandez à l'IA
Posez n'importe quelle question ou essayez l'une des questions suggérées pour commencer notre discussion
Résumer ce chapitre
Expliquer le code dans file
Expliquer pourquoi file ne résout pas la tâche
Awesome!
Completion rate improved to 7.14
Harder Converting
Glissez pour afficher le menu
You know a lot now! You can convert a lot of numbers from different numeral systems, but here we are going to dive deeper into built-in python functions for converting. Let's start with converting to a decimal one. Here is the function int() is useful.
For instance, to convert binary numbers to decimal representation you should start with 0b. Like int(0b10011010010), where 10011010010 number should be converted.
To do the same with the octal numeral system you have to use similar syntax int(0o2322) where 2322 should be converted.
I suppose you guessed the syntax for converting from a hexadecimal numeral system: int(0X4D2), where 4D2 number should be converted.
decimal_number1 = int(0b10011010010)
decimal_number2 = int(0o2322)
decimal_number3 = int(0X4D2)
It can be implemented not only with int(), such syntax is available for other numeral systems too:
# Сonverting from binary numeral system to the octal
oct(0b1010)
# Сonverting from octal numeral system to the hexadecimal
hex(0o237)
# Сonverting from hexadecimal numeral system to the binary
bin(0x8ea)
Swipe to start coding
I wish you good luck with this task, please follow the algorithm:
- Convert number 
4EAFfrom the hexadecimal numeral system to the octal. - Convert number 
2547from the octal numeral system to the binary. - Convert number 
1101011from the binary numeral system to the decimal. - Convert number 
2001from the decimal numeral system to the hexadecimal. 
Solution
Merci pour vos commentaires !
single