diff --git a/half_adjust.py b/half_adjust.py new file mode 100644 index 0000000..c5cd57d --- /dev/null +++ b/half_adjust.py @@ -0,0 +1,3 @@ +half_adjust = lambda n, u=0 : int(n * 10 ** u) / 10 ** u \ + if n * 10 ** u - int(n * 10 ** u) < 0.5 \ + else (int(n * 10 ** u) + 1) / 10 ** u \ No newline at end of file