Here you’ll get a python program to convert decimal to binary, positional notation and positional notation.
Python provides intrinsical functions for conversion of 1 numeration system to a different.
Convert decimal to binary victimisation bin() operate. In reborn binary kind, 0b is a gift at the start.
Convert decimal to positional notation victimisation oct() operate. In reborn positional notation kind, 0o is a gift at the start.
Convert decimal to positional notation victimisation hex() operate. In reborn positional notation kind 0x is a gift at the start.
Below program demonstrates that however, we are able to do these conversions.
Python Program to Convert Decimal to Binary, positional notation and positional notation
num = int(input("enter a decimal number: "))
print("\nbinary form is ", bin(num))
print("octal form is ", oct(num))
print("hexadecimal form is ", hex(num))
Output
enter a decimal number: 11
binary form is 0b1011
octal form is 0o13
hexadecimal form is 0xb
Comment below if you have got any queries concerning higher than the program.