Want to display a #Python float with a limited number of decimals? Use .nf as an f-string's format specifier. n is the number of digits to show after the decimal: x = 123.45678 print(f'{x:.2f}') # 123 ...