<jupyter_start><jupyter_text>Долги №1Поиск N позиций минимальных элементов [1, 2, 5, 0, 7, 9, 0, 1, 2, 3, 4] - na vhod, n = 51) result = [3, 6] - позиции минимального элемента = 02) от 0 до 3: [1, 2, 5].от 1 до 6: [7, 9].от 7 до конца: [1, 2, 2, 4]3) resull = [3, 6, 0] после первого срезаresult = [3, 6, 0, 7] после третьего среза4) Срезы : [2, 5], [2, 9], [], [2, 3, 4]result: [3, 6, 0, 7, 1] после первого срезаvalues_result : [0, 0, 1, 1, 2]Advice: result sorted = sort(result)<jupyter_code>def min_index(arg_list):
    index_min = 0
    min_element = arg_list[index_min]
    for i in range(1, len(arg_list)):
        if min_element > arg_list[i]:
            index_min = i
            min_element = arg_list[index_min]
    return index_min

def max_index(arg_list):
    index_max = 0
    max_element = arg_list[index_max]
    for i in range(1, len(arg_list)):
        if max_element < arg_list[i]:
            index_max = i
            max_element = arg_list[index_max]
    return index_max

def find_all_mins_index(arg_list, count_min_skips = 0):
    arg_list = [] + arg_list
    if count_min_skips != 0:
        for s in range(0, count_min_skips):
            
            index_min_el = min_index(arg_list)
            min_elem = arg_list[index_min_el]
            
            index_min_el = max_index(arg_list)
            max_elem = arg_list[index_min_el]
            for i in range(0, len(arg_list)):
                if arg_list[i] == min_elem:
                    arg_list[i] = max_elem
                
    index_min_el = min_index(arg_list)
    elem = arg_list[index_min_el]
    res = []
    for i in range(0, len(arg_list)):
        if elem == arg_list[i]:
            res += [i]
    return res

def find_n_pos(arg_list, n):
    result = []
    
    indexMins = find_all_mins_index (arg_list)
    for i in range(0, n):
        #print(arg_list, i, find_all_mins_index (arg_list, i))
        result += find_all_mins_index (arg_list, i)
        if len(result) >= n: break
    
    return result[0:n]
print(find_n_pos([0, 1, 4, 2, 1, 8, 9, 4, 6], 5))

#[1, 2, 5, 0, 7, 9, 0, 1, 2, 3, 4]<jupyter_output>[0, 1, 4, 3, 2]<jupyter_text>Тест функции find_all_mins_index<jupyter_code>print(find_all_mins_index([1, 2, 5, 0, 7, 9, 0, 1, 2, 3, 4]))<jupyter_output>[3, 6]
{'fraction_non_alphanumeric': 0.1311619718309859, 'fraction_numerical': 0.04753521126760563, 'mean_word_length': 2.607936507936508, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '186816', 'license': 'MIT', 'n_tokens_mistral': 1007, 'n_tokens_neox': 942, 'n_words': 238, 'path': 'hw 28_10_2021.ipynb', 'repo_name': 'yuraMovsesyan/msu_hw', 'size': '2272'}