code
# 获取用户输入十进制数 dec = 255 print("十进制数为:", dec) print("转换为二进制为:", bin(dec)) print("转换为八进制为:", oct(dec)) print("转换为十六进制为:", hex(dec))
code
# 获取用户输入十进制数 dec = 255 print("十进制数为:", dec) print("转换为二进制为:", bin(dec)) print("转换为八进制为:", oct(dec)) print("转换为十六进制为:", hex(dec))