Answers for "change float to int python list"

16

convert float to int python

# convert float to int 
x=3.1415
y=int(x)
print(y) #outputs 3
Posted by: Guest on December-08-2020
0

convert python float list to 2 digit

my_list = [0.30000000000000004, 0.5, 0.20000000000000001]
my_formatted_list = [ '%.2f' % elem for elem in my_list ]
Posted by: Guest on July-10-2020

Code answers related to "change float to int python list"

Python Answers by Framework

Browse Popular Code Answers by Language