Advertisement
PowerCell46

Messaging Python

Jan 17th, 2023
685
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.70 KB | None | 0 0
  1. sequence_of_numbers = input().split()
  2. list_of_sums = []
  3. input_string = input()
  4.  
  5. for i in range(0, len(sequence_of_numbers)):
  6.     current_sequence = sequence_of_numbers[i]
  7.     current_sum = 0
  8.     for index in range(0, len(current_sequence)):
  9.         current_number = int(current_sequence[index])
  10.         current_sum += current_number
  11.     list_of_sums.append(current_sum)
  12.  
  13. string_list = [char for char in input_string]
  14. print_output = ""
  15.  
  16. for i in range(0, len(list_of_sums)):
  17.     current_sum = list_of_sums[i]
  18.     while current_sum >= len(string_list):
  19.         current_sum -= len(string_list)
  20.     print_output += string_list[current_sum]
  21.     string_list.pop(current_sum)
  22.  
  23. print(print_output)
  24.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement