Cetak dua digit setelah python desimal
float = 2.154327
format_float = "{:.2f}".format(float)
print(format_float)
Sore Stork
float = 2.154327
format_float = "{:.2f}".format(float)
print(format_float)
formatted_float = "{:.2f}".format(a_float)
# round a value to 2 decimal points
value_to_print = 123.456
print(f'value is {round(value_to_print, 2)}')
# prints: value is 123.46
for i in range(10):
j=i*0.1
print('%0.2f' %j)