β μ§μ λ³ν νλ‘κ·Έλ¨
sel = int(input("μ
λ ₯ μ§μ κ²°μ (16,10,8,2) :"))
num = input("κ° μ
λ ₯: ")
if sel == 16 :
num10 = int(num,16)
if sel == 10 :
num10 = int(num,10)
if sel == 8 :
num10 = int(num,8)
if sel == 2 :
num10 = int(num,2)
print("16μ§μ ==> ", hex(num10))
print("8μ§μ ==> ", oct(num10))
print("2μ§μ ==> ", bin(num10))
print("10μ§μ ==> ", num10)
β μ§μ λ³ν νλ‘κ·Έλ¨ (μμ©)
: κ°μ§ μλ€λ != μ¬μ©
: κ΄κ³μ°μ°μ and μ¬μ©
sel = int(input("μ
λ ₯ μ§μ κ²°μ (16,10,8,2) :"))\
if sel != 16 and 10 and 8 and 2 :
print("16,10,8,2 μ€μ νλλ§ μ
λ ₯νμΈμ")
exit()
num = input("κ° μ
λ ₯: ")
if sel == 16 :
num10 = int(num,16)
if sel == 10 :
num10 = int(num,10)
if sel == 8 :
num10 = int(num,8)
if sel == 2 :
num10 = int(num,2)
print("16μ§μ ==> ", hex(num10))
print("8μ§μ ==> ", oct(num10))
print("2μ§μ ==> ", bin(num10))
print("10μ§μ ==> ", num10)