Skip to content

Assert qui ne passe pas pour le défi DF8PT [EP24] - 01.2 #55

Open
@tfontanet

Description

@tfontanet

Bonjour,

Pour le défi DF8PT, [EP24] - 01.2, je pense avoir mis la bonne réponse et pourtant je ne passe pas le test 1 !

Voici mon code :

def echange(tab, i, j):
    '''Echange les éléments d'indice i et j dans le tableau tab.'''
    temp = tab[i] 
    tab[i] = tab[j]
    tab[j] = temp 

def tri_selection(tab):
    '''Trie le tableau tab dans l'ordre croissant
    par la méthode du tri par sélection.'''
    N = len(tab)
    for k in range(N): 
        imin = k 
        for i in range(k+1, N): 
            if tab[i] < tab[imin]: 
                imin = i
        echange(tab, imin, k)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bogueQuelque chose ne tourne pas rond...

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions