Sichanov

beggars

Sep 29th, 2021
189
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.74 KB | None | 0 0
  1. string_of_integers = input().split(', ')
  2. count_of_beggars = int(input())
  3. sum_of_integers = 0
  4. more_sum_of_integers = 0
  5. output = []
  6. if count_of_beggars < len(string_of_integers):
  7.     output = [0] * count_of_beggars
  8.     index = 0
  9.     for i in range(len(string_of_integers)):
  10.         if index == count_of_beggars:
  11.             index = 0
  12.         output[index] += int(string_of_integers[i])
  13.         index += 1
  14. elif count_of_beggars == len(string_of_integers):
  15.     for x in string_of_integers:
  16.         output.append(int(x))
  17. elif count_of_beggars > len(string_of_integers):
  18.     for x in string_of_integers:
  19.         output.append(int(x))
  20.     for x in range(count_of_beggars - len(string_of_integers)):
  21.         output.append(0)
  22. print(output)
  23.  
Advertisement
Add Comment
Please, Sign In to add comment