string format % floar code example Example: float format decimal places num = 1.234 print("{:.2f}".format(num)) >> 1.23 print(f"{num:.2f}") >> 1.23