kyu_8.formatting_decimal_places_0 package

Submodules

kyu_8.formatting_decimal_places_0.test_two_decimal_places module

Test for -> Formatting decimal places #0.

Created by Egor Kostan. GitHub: https://github.com/ikostan

class kyu_8.formatting_decimal_places_0.test_two_decimal_places.TwoDecimalPlacesTestCase(methodName='runTest')[source]

Bases: TestCase

Testing two_decimal_places function.

_classSetupFailed = False
_class_cleanups = []
test_two_decimal_places = None
test_two_decimal_places_0(**kw)

Testing two_decimal_places function with various test inputs [with n=4.659725356, expected=4.66, msg=”didn’t work for 4.659725356”].

Each number should be formatted that it is rounded to two decimal places. You don’t need to check whether the input is a valid number because only valid numbers are used in the tests. :return:

test_two_decimal_places_1(**kw)

Testing two_decimal_places function with various test inputs [with n=173735326.37837327, expected=173735326.38, msg=”didn’t work for 173735326.3783732637948948”].

Each number should be formatted that it is rounded to two decimal places. You don’t need to check whether the input is a valid number because only valid numbers are used in the tests. :return:

test_two_decimal_places_2(**kw)

Testing two_decimal_places function with various test inputs [with n=4.653725356, expected=4.65, msg=”didn’t work for 4.653725356”].

Each number should be formatted that it is rounded to two decimal places. You don’t need to check whether the input is a valid number because only valid numbers are used in the tests. :return:

kyu_8.formatting_decimal_places_0.two_decimal_places module

Solution for -> Formatting decimal places #0.

Created by Egor Kostan. GitHub: https://github.com/ikostan

kyu_8.formatting_decimal_places_0.two_decimal_places.two_decimal_places(n: float) float[source]

Convert a number into decimal.

Each number should be formatted that it is rounded to two decimal places. You don’t need to check whether the input is a valid number because only valid numbers are used in the tests. :param n: float :return: float

Module contents

Formatting decimal places #0.