shorten all floats in a list code example
Example: shorten all floats in a list
my_list = [1.000, 2.41, 2.5566778]
my_rounded_list = [ round(elem, 2) for elem in my_list ]
my_rounded_list == [1.00, 2.41, 2.56]
my_list = [1.000, 2.41, 2.5566778]
my_rounded_list = [ round(elem, 2) for elem in my_list ]
my_rounded_list == [1.00, 2.41, 2.56]