filmov
tv
Octal to Decimal & Decimal to Octal Number Conversion in Python | #Shorts by OsChannel

Показать описание
Subscribe to OsChannel for more such tutorial videos, tips and tricks.
# About this video:
This video contains a way to convert Decimal Numbers to Octal and then converting back the Octal Numbers to Decimal format using the oct() and int() functions in Python3.
Let's say we have a number x = 15
To convert to Octal format use oct(x) which gives the output 0o143
the '0o' at the beginning represents octal format number.
To Convert the Octal number back to Decimal format we can use the int() function with a base of 8 as folows int('0o143', 8) and this gives us the output as 15.
We can use slicing to get rid of the octal representation prefix '0o' like this: oct(x)[2:] and it gives it the octal digits 143. to convert back these octal digits we can use int() function again with base of 8 as follows: int(143, 8) and this gives back Decimal Number 15.
# About OsChannel:
# Watch all #Short Videos by Oschannel:
# CHANNEL LINK:
# LINK TO MY WEBSITE:
#Python #Binary #PythonShorts #PythonNumbers
# About this video:
This video contains a way to convert Decimal Numbers to Octal and then converting back the Octal Numbers to Decimal format using the oct() and int() functions in Python3.
Let's say we have a number x = 15
To convert to Octal format use oct(x) which gives the output 0o143
the '0o' at the beginning represents octal format number.
To Convert the Octal number back to Decimal format we can use the int() function with a base of 8 as folows int('0o143', 8) and this gives us the output as 15.
We can use slicing to get rid of the octal representation prefix '0o' like this: oct(x)[2:] and it gives it the octal digits 143. to convert back these octal digits we can use int() function again with base of 8 as follows: int(143, 8) and this gives back Decimal Number 15.
# About OsChannel:
# Watch all #Short Videos by Oschannel:
# CHANNEL LINK:
# LINK TO MY WEBSITE:
#Python #Binary #PythonShorts #PythonNumbers