↓ |
2 binary |
8 binary |
10 binary |
16 binary |
2 binary |
- |
Bin (int (x, 8)) |
Bin (int (x, 10)) |
Bin (int (x, 16)) |
8 binary |
Oct (int (x, 2)) |
- |
Oct (int (x, 10)) |
Oct (int (x, 16)) |
10 binary |
int (x, 2) |
int (x, 8) |
- |
int (x, 16) |
16 binary |
Hex (int (x, 2)) |
Hex (int (x, 8)) |
Hex (int (x, 10)) |
- |
Example:
Number = 10Number_bin=Bin (number) Number_oct=Oct (number) Number_hex=Hex (number)Print("---------------Decimal Conversion-----------------------------")Print(Number,"The binary representation of the corresponding binary is:", Number_bin)Print(Number,"The corresponding octal representation is:", Number_oct)Print(Number,"The corresponding hexadecimal representation is:", Number_hex)Print("---------------binary Conversion-----------------------------")Print(Number_bin,"The corresponding decimal representation is:", Int (Number_bin, 2))Print(Number_bin,"The corresponding octal representation is:", The Oct (int (number_bin, 2)))Print(Number_bin,"The corresponding hexadecimal representation is:", Hex (int (Number_bin, 2)))Print("---------------octal Conversion-----------------------------")Print(Number_oct,"The corresponding decimal representation is:", Int (NUMBER_OCT, 8))Print(Number_oct,"The binary representation of the corresponding binary is:", Bin (int (number_oct, 8)))Print(Number_oct,"The corresponding hexadecimal representation is:", Hex (int (NUMBER_OCT, 8)))Print("---------------16 binary conversion-----------------------------")Print(Number_hex,"The corresponding decimal representation is:", Int (Number_hex, 16))Print(Number_hex,"The binary representation of the corresponding binary is:", Bin (int (Number_hex, 16)))Print(Number_hex,"The corresponding octal representation is:", Oct (int (number_hex, 16)))
Python's binary conversion