Codewars python

topic description

You have an array of numbers.
Your task is to sort ascending odd numbers but even numbers must be on their places.

Zero isn"t an odd number and you don"t need to move it. If you have an empty array, you need to return it.

Example

sort_array ([5, 3, 2, 8, 1, 4]) = [1, 3, 2, 8, 5, 4]

sources of topics and their own ideas

from a python topic in codewars

related codes

/ / Please paste the code text below (do not replace the code with pictures)
my code is as follows:

 def sort_array(source_array):
    -sharp Return a sorted array.
    arr = []
    dict_even = dict()
    if len(source_array) != 0: 
        for mark, value in enumerate(source_array):
            if value % 2 != 0:
                arr.append(value)
                arr = sorted(arr)
            else:
                dict_even[mark] = value
        for key,value in dict_even.items():
            arr.insert(key,value)
                
        return arr
    else:
        return source_array

but there are always two errors in the running result, and I don"t know where the specific problem is! The running result is as follows:

what result do you expect? What is the error message actually seen?

Test Results:
Test Passed
[0, 1, 2, 3, 4, 5, 6, 7, 9, 8] should equal [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
[0, 1, 2, 3, 4, 5, 8, 8, 7, 9, 6] should equal [0, 1, 2, 3, 4, 5, 8, 7, 6, 9]
Test Passed
Test Passed Describe where we can communicate again if it is not clear

Mar.29,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1eb1515-2346.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1eb1515-2346.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?