tableauxdavancement.py

Created by christopher-balme037

Created on November 11, 2021

1.33 KB


# Type your text here
n=int(input("Combien de réactifs différents ?"))
m=int(input("Combien de produits différents ?"))
R,P,X,Y=[],[],[],[]
for i in range(n):
    print("-----Pour le réactif n°",i+1)
    a=float(input("Quantité de matière du réactif à l'état initial(en moles)"))
    x=int(input("nombre stoechiométrique du même réactif (entier)"))
    R.append(a)
    X.append(x)
for k in range(m):
    print("-----Pour le produit n°",k+1)
    b=float(input("Quantité de matière du produit à l'état initial (en moles)"))
    y=int(input("Nombre stoechiométrique du même produit (entier)"))
    P.append(b)
    Y.append(y)
E=R+P
Z=X+Y



for i in range(3):
    print('')
print(" ")
for i in range(len(Z)):
    print(Z[i],chr(65+i),' ')
print(" ")
print("E initial : ")
for i in range(len(E)):
    print(E[i]," ")
print(" ")
print("E en cours : ")
for i in range(n):
    print(E[i],"-",Z[i],"x"," ")
for i in range(m):
    print(P[i],"+",Y[i],"x"," ")
print(" ")
a=E[0]/Z[0]
for i in range(n):
    b=E[i]/Z[i]
    if b<a:
        a=b
a=int(a*10000)/10000
print("E final : ")
for i in range(n):
    print(float(int(((E[i]-Z[i]*a)*10000))/10000),' ')
for i in range(m):
    print(float(int(((P[i]+Y[i]*a)*10000))/10000)," ")
for i in range(1):
    print('')
    print("L'avancement maximal de la réaction vaut x=",a,"mol")

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.