Answers for "make list round to 1 or 0 python"

4

round python with list

a_list = [1.234, 2.345, 3.45, 1.45]
round_to_whole = [round(num) for num in a_list]

print(round_to_whole)
Posted by: Guest on September-11-2020
1

why does python round 0.5 to 0

i = round(0.5)
print(i)
Posted by: Guest on July-28-2021

Python Answers by Framework

Browse Popular Code Answers by Language