Skip to content

Found line with high Jones Complexity: 15 > 14 - shouldn't be showing up #116

@darya-andreyeva

Description

@darya-andreyeva
  1. Open https://hyperskill.org/learn/step/7718
  2. Submit the following code:
def condition(x, y, gt):
    return x > y if gt else x < y


def min_max_sort(elements):
    gt = 1
    for i in range(len(elements) - 1):
        index = i
        gt = (gt + 1) & 1

        for j in range(i + 1, len(elements)):
            if condition(elements[j], elements[index], gt):
                index = j
                
        elements[i], elements[index] = elements[index], elements[i]


ar = list(map(int, input().split()))
min_max_sort(ar)
print(*ar)

There is a code style error for elements[i], elements[index] = elements[index], elements[i]:

Found incorrect unpacking target 
Found incorrect unpacking target 
Found line with high Jones Complexity: 15 > 14 

that didn't show up 4 months ago.

Metadata

Metadata

Assignees

Labels

bugSomething isn't workinggood first issueGood for newcomershelp wantedExtra attention is needed

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions