Sichanov

beggars

Sep 30th, 2021 (edited)
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.32 KB | None | 0 0
  1. string_money = input().split(', ')
  2. beggars = int(input())
  3. int_money = []
  4. final_list = [0] * beggars
  5. for i in string_money:
  6.     int_money.append(int(i))
  7.  
  8. index = 0
  9. for i in range(len(int_money)):
  10.     final_list[index] += int_money[i]
  11.     index += 1
  12.     if index == beggars:
  13.         index = 0
  14.  
  15. print(final_list)
  16.  
Add Comment
Please, Sign In to add comment