{"id":19332,"date":"2021-08-30T16:06:24","date_gmt":"2021-08-30T10:36:24","guid":{"rendered":"https:\/\/python-programs.com\/?p=19332"},"modified":"2021-11-22T18:37:07","modified_gmt":"2021-11-22T13:07:07","slug":"python-program-to-convert-hexadecimal-to-octal","status":"publish","type":"post","link":"https:\/\/python-programs.com\/python-program-to-convert-hexadecimal-to-octal\/","title":{"rendered":"Python Program to Convert Hexadecimal To Octal"},"content":{"rendered":"

In the previous article, we have discussed Python Program to Convert Hexadecimal to Decimal<\/a>
\nGiven a hexadecimal number and the task is to get the respective octal number.<\/p>\n

Examples:<\/strong><\/p>\n

Example1:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Hexadecimal String = \"5B\"<\/pre>\n

Output:<\/strong><\/p>\n

The Octal value of the given Hexadecimal number { 5B } is: \r\n133<\/pre>\n

Example2:<\/strong><\/p>\n

Input:<\/strong><\/p>\n

Given Hexadecimal String = \"3DA\"<\/pre>\n

Output:<\/strong><\/p>\n

The Octal value of the given Hexadecimal number { 3DA } is: \r\n1732<\/pre>\n

Program to Convert Hexadecimal To Octal in Python<\/h2>\n

Below are the ways to convert the given hexadecimal number into octal :<\/p>\n