0
Floats
how to say python that how many float points to print, example 5.68 only 2 float points
1 Antwort
+ 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