Форум сайта python.su
0
задачка на codewars - определить кто сколько не доплатил в общем счете.
если считаю и вывожу через print, знаки после запятой в словаре присутствуют. Когда же система применяет assert, чтобы проверить решение, они пропадают. не могу понять в чем дело
вот скрин: http://prntscr.com/nj2wid
ps Всех с праздником )) 
Отредактировано Fixx_Jr (Май 1, 2019 15:25:57)
Офлайн
857
Fixx_JrОпиши задачу.
задачка на codewars
Офлайн
0
It's tricky keeping track of who is owed what when spending money in a group. Write a function to balance the books.
The function should take one parameter: an object/dict with two or more name-value pairs which represent the members of the group and the amount spent by each.
The function should return an object/dict with the same names, showing how much money the members should pay or receive.
Further points:
The values should be positive numbers if the person should receive money from the group, negative numbers if they owe money to the group.
If value is a decimal, round to two decimal places.
Translations and comments (and upvotes!) welcome.
Example
3 friends go out together: A spends £20, B spends £15, and C spends £10. The function should return an object/dict showing that A should receive £5, B should receive £0, and C should pay £5.
Офлайн
857
Попробуй вручную округлить (не через round() )
>>> int(123111.11446 * 100) / 100 123111.11 >>>
Отредактировано py.user.next (Май 1, 2019 20:19:55)
Офлайн
0
не помогло.
где-то на проверке ломается, судя по всему
Офлайн