Answers for "Python simple number formatting samples"

0

Python simple number formatting samples

# integer arguments
print("The number is:{:d}".format(123))

# float arguments
print("The float number is:{:f}".format(123.4567898))

# octal, binary and hexadecimal format
print("bin: {0:b}, oct: {0:o}, hex: {0:x}".format(12))
Posted by: Guest on January-28-2022

Python Answers by Framework

Browse Popular Code Answers by Language