Python redondo com lista
a_list = [1.234, 2.345, 3.45, 1.45]
round_to_whole = [round(num) for num in a_list]
print(round_to_whole)
Rocku0
a_list = [1.234, 2.345, 3.45, 1.45]
round_to_whole = [round(num) for num in a_list]
print(round_to_whole)
round(number, decimalPlaces = 0)
#round print
process = 1345 * 0.75
print(f"The result can be shown as {round(process, 1)}") #output:1008.8
print(f"The result can be shown as {round(process, 2)}") #output:1008.75
print(round(2.555, 2))
print(round(2.786, 2))
print(round(2.553, 2))
>>> print(round(89.92345,2)), round(89.725))
89.92 90
def round(num):
remainder = num - int(num)
if remainder >= 0.5:
return int(num) + 1
return int(num)