Найти - Пользователи
Полная версия: пропадают знаки после запятой
Начало » Python для новичков » пропадают знаки после запятой
1
Fixx_Jr
задачка на codewars - определить кто сколько не доплатил в общем счете.
если считаю и вывожу через print, знаки после запятой в словаре присутствуют. Когда же система применяет assert, чтобы проверить решение, они пропадают. не могу понять в чем дело

вот скрин: http://prntscr.com/nj2wid


ps Всех с праздником ))
py.user.next
Fixx_Jr
задачка на codewars
Опиши задачу.
Fixx_Jr
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.
py.user.next
Попробуй вручную округлить (не через round() )
  
>>> int(123111.11446 * 100) / 100
123111.11
>>> 
Fixx_Jr
не помогло.
где-то на проверке ломается, судя по всему
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Powered by DjangoBB