IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Contribuez Python Discussion :

[Python]-aide pour un projet


Sujet :

Contribuez Python

  1. #1
    Nouveau Candidat au Club
    Femme Profil pro
    Étudiant
    Inscrit en
    Mars 2017
    Messages
    1
    Détails du profil
    Informations personnelles :
    Sexe : Femme
    Localisation : France, Isère (Rhône Alpes)

    Informations professionnelles :
    Activité : Étudiant
    Secteur : Agroalimentaire - Agriculture

    Informations forums :
    Inscription : Mars 2017
    Messages : 1
    Points : 1
    Points
    1
    Par défaut [Python]-aide pour un projet
    Bonjour, dans le cadre d'un projet, je dois programmer de sorte de mimer une croissance bactérienne. Cependant je ne vois pas où est le problème ou comment arranger mon programme pour qu'il fonctionne.
    Merci à ceux qui pourront m'aider

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    #import random
    import numpy as np
    import matplotlib.pyplot
     
    nb_bacterie=3
    duree_experience=3000 #28800 #8j
    duree_cycle=35
    matiere_nutritive_initiale=5000
    quantite_matiere_necessaire_division=50
    duree_survie_jeun=10
    coeff_exploitation=0.10
     
    def colonie(bacterie,matiere_nutritive,duree_experience):
        bacterie=[[k,0,0,0] for k in range (nb_bacterie)]
        matiere_nutritive=matiere_nutritive_initiale
        Y=[]
        for k in range (duree_experience):
            nouvelle_bact=0
            a=len(bacterie)
            matiere_assimilee_par_u_temps=matiere_nutritive*coeff_exploitation
            if matiere_nutritive>=matiere_assimilee_par_u_temps*a:
                matiere_nutritive=matiere_nutritive-matiere_assimilee_par_u_temps*a
                for i in range (0,a):
                    bacterie[i][2]= [bacterie[i][2]+matiere_assimilee_par_u_temps]
                    if bacterie[i][2]>=quantite_matiere_necessaire_division:#c'est ici le probleme selon python
                        nouvelle_bact+=1
                    if bacterie[i][1]==duree_cycle:
                        bacterie.pop(i)
                    bacterie[i][1]+=1
                for k in range (nouvelle_bact):
                    bacterie.append([len(bacterie),0,0,0])
            else:
                a=int(matiere_nutritive/len(bacterie))
                matiere_nutritive=0
                for i in range (a):
                    bact_mange=random.randint(0,len(bacterie)-1)
                    bacterie[bact_mange][2]+=matiere_assimilee_par_u_temps
                for i in range (len(bacterie)):
                    if bacterie[i][1]==duree_cycle:
                        bacterie.pop(i)
                    bacterie[i][1]+=1
                    if bacterie[i][2]>=quantite_matiere_necessaire_division:
                        nouvelle_bact+=1
                    if bacterie[i][3]==duree_survie_jeun:
                        bacterie.pop(i)
                    else: 
                        bacterie[i][3]+=1
                for k in range (nouvelle_bact):
                    bacterie.append([len(bacterie),0,0,0])
            Y.append(len(bacterie))
        return Y
    encore merci et désolé, je n'arrive pas à garder l'indentation

  2. #2
    Expert éminent sénior
    Homme Profil pro
    Architecte technique retraité
    Inscrit en
    Juin 2008
    Messages
    21 287
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Manche (Basse Normandie)

    Informations professionnelles :
    Activité : Architecte technique retraité
    Secteur : Industrie

    Informations forums :
    Inscription : Juin 2008
    Messages : 21 287
    Points : 36 776
    Points
    36 776
    Par défaut
    Salut,

    Citation Envoyé par wwwboulet Voir le message
    Cependant je ne vois pas où est le problème ou comment arranger mon programme pour qu'il fonctionne.
    Il faut commencer par décrire ce que vous appelez "problème" en postant s'il y en a les messages d'erreurs.

    - W
    Architectures post-modernes.
    Python sur DVP c'est aussi des FAQs, des cours et tutoriels

Discussions similaires

  1. Besoin d'aide pour un projet en vb6
    Par Tyrael62 dans le forum VB 6 et antérieur
    Réponses: 5
    Dernier message: 14/01/2006, 05h25
  2. de l'aide pour un projet svp!!!!
    Par lamoon dans le forum PostgreSQL
    Réponses: 3
    Dernier message: 09/01/2006, 15h45
  3. Besoin d'aide pour un projet
    Par ZiMo dans le forum Linux
    Réponses: 9
    Dernier message: 24/10/2005, 00h28
  4. Besoin d'aide pour un projet de jeu en ligne
    Par FLEO dans le forum Projets
    Réponses: 1
    Dernier message: 21/10/2005, 08h55
  5. [CAML] Recherche aide pour un projet
    Par tarzoon dans le forum Caml
    Réponses: 1
    Dernier message: 02/09/2005, 10h32

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo