Advertisement
elena1234

How to looping in Python

Feb 2nd, 2022
1,441
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.26 KB | None | 0 0
  1. text = input().split(", ")
  2. coins = list(map(int, text))
  3. number_beggars = int(input())
  4. list_output = [0] * number_beggars
  5.  
  6. for i in range(0, len(coins)):
  7.     currentBeggar = i % number_beggars
  8.     list_output[currentBeggar] += coins[i]
  9.  
  10. print(list_output)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement