Rounding Functions in Python
roundmath.floormath.ceilЗадание 1
Given a fraction:
pythonnum = 16.456
Round this fraction to the nearest whole number.
Задание 2
Given a fraction:
pythonnum = 21.167
Round this fraction to two decimal places.
Задание 3
Given a fraction:
pythonnum = 3.348
Round this fraction up to the nearest whole number.
Задание 4
Given a fraction:
pythonnum = 18.565
Round this fraction down to the nearest whole number.
Задание 5
Given a number:
pythonnum = 17
Find the square root of this number and round the result to two decimal places.
Задание 6
Given a number:
pythonnum = 17
Find the cube root of this number and round the result up.
Задание 7
Given a list:
pythonlst = [3.45, 1.54, 5.76]
Round each of its elements to the nearest whole number.
Задание 8
Two lists are given:
pythonlst1 = [1.514, 4.897, 2.657]
lst2 = []
Write the code to get the following result:
pythonlst2 = [1, 4, 2]