IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Voir le flux RSS

Messages des blogs récents

  1. Python. Diviser un brin d'ADN en mots de n lettres, construire un dict des mots

    par , 06/03/2020 à 21h53
    Code Python : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    #! python3
    # coding: utf-8
     
     
    def compte_mots_n_lettres(brin, n):
        nb = len(brin)//n
        print('La division de la longueur du brin {} en mot de {} lettres donne {} mots.\n'.format(
            len(brin), n, nb))
        if nb*n < len(brin):
            print('Il restera {} dans le brin.\n'.format(brin[nb*n:]))
        dict_brin = {}
        mots = []
        temp = 0
        for index in range(n, len(brin)+1, n):
    ...

    Mis à jour 11/03/2020 à 18h34 par danielhagnoul (Correction, erreur de débutant, voir messages)

    Catégories
    Python , Python , Programmation