Q:

Write a Python program to print four values decimal, octal, hexadecimal (capitalized), binary in a single line of a given integer

0

Write a Python program to print four values decimal, octal, hexadecimal (capitalized), binary in a single line of a given integer. 

All Answers

need an explanation for this answer? contact us directly to get an explanation for this answer

i = int(input("Input an integer: "))
o = str(oct(i))[2:]
h = str(hex(i))[2:]
h = h.upper()
b = str(bin(i))[2:]
d = str(i)
print("Decimal Octal Hexadecimal (capitalized), Binary")
print(d,'  ',o,' ',h,'                   ',b)

need an explanation for this answer? contact us directly to get an explanation for this answer

total answers (1)

Similar questions


need a help?


find thousands of online teachers now