val = 345.09874
now i want output like 345.10, 345.09 and 345.099 in python 2.7
Please help me.
val = 345.09874
now i want output like 345.10, 345.09 and 345.099 in python 2.7
Please help me.
Just to encourage you I am providing the answer, but next time you should google first.
Use this:
print round(val,2)
I could get 2 out of 3 values using:
val = 345.09874
print("%.2f" % round(val,2)) #345.10
print("%.3f" % round(val,3)) #345.099
I dont know how to get the output with 345.09