Rounding Functions in Python
Given a fraction:
num = 16.456
Round this fraction to the nearest whole number.
Given a fraction:
num = 21.167
Round this fraction to two decimal places.
Given a fraction:
num = 3.348
Round this fraction up to the nearest whole number.
Given a fraction:
num = 18.565
Round this fraction down to the nearest whole number.
Given a number:
num = 17
Find the square root of this number and round the result to two decimal places.
Given a number:
num = 17
Find the cube root of this number and round the result up.
Given a list:
lst = [3.45, 1.54, 5.76]
Round each of its elements to the nearest whole number.
Two lists are given:
lst1 = [1.514, 4.897, 2.657]
lst2 = []
Write the code to get the following result:
lst2 = [1, 4, 2]