Floats | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Floats

how to say python that how many float points to print, example 5.68 only 2 float points

9th Oct 2017, 2:33 AM
Thirumurugan Elango
1 Answer
+ 3
my_num = 123.45678 my_round = round(my_num, 2) print(my_round) This is going to give you 123.45. The second argument of this builtin function is the number of simbols after the separator. Another way is just to call: round(123.45678, 3) This will give you 123.456
9th Oct 2017, 5:18 AM
Leno
Leno - avatar