We use Python 3.6

go back Level: Beginner (img: BG / score: 2) level Bite 117. Round a number even (a.k.a. banker's rounding)

25 out of 25 users completed this Bite ...
Will you be Pythonista #26 to crack this Bite?
Average Bite difficulty 1-10 rating: 3.5
» You can do it! 😌

Bankers Rounding is an algorithm for rounding quantities to integers, in which numbers which are equidistant from the two nearest integers are rounded to the nearest even integer. Thus, 0.5 rounds down to 0; 1.5 rounds up to 2. - source

Complete the function below that takes an int, returning it rounded even. You probably want to look at the decimal module.

Github login button