avancement_1.py

Created by julien-bernon

Created on September 30, 2019

1.74 KB


print("Traceur de tbl d'avc")
print("\nI - Définition de l'équation de réaction")



def subs():
    print("\n1) subs présentes/produites")
    
    nb_rc=int(input("Combien y a-t-il de réactifs ?\n"))
    nb_prd=int(input("Combien y a-t-il de produits ?\n"))
    rc=[]
    for i in range(nb_rc):
        rc.append(([input("Symbole du réactif n°"+str(i+1)+" ?\n"),0,0,0,0]))
    
    prd=[]
    for i in range(nb_prd):
        prd.append([input("Symbole du produit n°"+str(i+1)+" ?\n"),0,0,0,0])
    print("OK.")
    return rc,prd


def stk(rc,prd):
    print("2) Coefficients stoechiométriques")
    for i in rc:
        i[1]=float(input("Coefficient devant "+i[0]+" ?\n"))
        if(i[1]==int(i[1])):
            i[1]=int(i[1])
    for i in prd:
        i[1]=float(input("Coefficient devant "+i[0]+" ?\n"))
        if(i[1]==int(i[1])):
            i[1]=int(i[1])
    print("\n\nL'équation de réaction est donc :")
    equa=""
    for i in rc:
        equa+=str(i[1])+i[0]+" + "
    equa=equa[0:-2]
    equa+= "--> "
    for i in prd:
        equa+=str(i[1])+i[0]+" + "
    equa=equa[0:-2]
    print("\n"+equa)
    return rc,prd


def quantites(rc,prd):
    print("\n\n3) Quantités de matières initiales")
    print("/!\\"+ "Si la quantité n'est\npas connue, entrer N")
    print("Pour écrire '2,5x10^-3' entre\n 2.5e-3")
    for i in rc:
        i[2]=input("Quantité initiale de "+i[0]+" ?\n")
        if (i[2]!="N"):
            i[2]=float(i[2])
    for i in prd:
        i[2]=input("Quantité initiale de "+i[0]+" ?\n")
        if (i[2]!="N"):
            i[2]=float(i[2])
    return rc,prd




rc,prd=subs()
rc,prd=stk(rc,prd)
rc,prd=quantites(rc,prd)
tbl=tbl_litt(rc,prd)
rc,xmax=avc_max(rc)
rc,prd,xmax,tbl=bilan_matiere(rc,prd,xmax,tbl)

During your visit to our site, NumWorks needs to install "cookies" or use other technologies to collect data about you in order to:

With the exception of Cookies essential to the operation of the site, NumWorks leaves you the choice: you can accept Cookies for audience measurement by clicking on the "Accept and continue" button, or refuse these Cookies by clicking on the "Continue without accepting" button or by continuing your browsing. You can update your choice at any time by clicking on the link "Manage my cookies" at the bottom of the page. For more information, please consult our cookies policy.