Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

test: ROUND = [('round', (0.22), 0), ('round', (-0.22), 0), ('round', (0.5), 0), ('round', (5.844, 1), 5.8), ('round', (5.848, 2), 5.85), ('round', (3.55, 1), 3.6),

test:

ROUND = \

[('round', (0.22), 0),

('round', (-0.22), 0),

('round', (0.5), 0),

('round', (5.844, 1), 5.8),

('round', (5.848, 2), 5.85),

('round', (3.55, 1), 3.6),

('round', (3.45, 1), 3.4)]

image text in transcribed
round() Write a function round (number [, ndigits]) that models the behavior of the built-in function. Input: a float number, and an optional argument, a non-negative integer ndigits. The default parameter value for ndigits is 0. Output: if ndigits is 0, an integer, else a float, rounded to ndigits after the decimal point. If the first dropped digit is greater than 5, round up; if the first dropped digit is less than 5, round down; else round in such a way that the remaining digit in the smallest position is even

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions