xmax.py

Created by mino-1289

Created on February 23, 2021

1.87 KB

Réactif limitant en chimie


nbr_react = int(input("Nombre de réactif(s) : "))

n1 = float(input("\nQuantité du 1er réactif : "))
co1 = int(input("Coeficient stoechiométrique\ndu 1er réactif : "))

if nbr_react >= 2:
    n2 = float(input("\nQuantité du 2ème réactif : "))
    co2 = int(input("Coeficient stoechiométrique\ndu 2ème réactif : "))
    if nbr_react == 3:
        n3 = float(input("\nQuantité du 3ème réactif : "))
        co3 = int(input("Coeficient stoechiométrique\ndu 3ème réactif : "))

xmax_1 = n1/co1
if nbr_react >= 2:
    xmax_2 = n2/co2
    if nbr_react == 3:
        xmax_3 = n3/co3

if nbr_react == 1:
    print("\nLe réactif limitant est \nle 1er (il est le seul) avec xmax = " + str(xmax_1))

if nbr_react == 2:
    if xmax_1 == xmax_2:
        print("\nLa réaction est totale\nxmax = " + str(xmax_2))
    elif xmax_2 > xmax_1:
        print("\nLe réactif limitant est\nle 1er avec xmax = " + str(xmax_1) + " mol\
            \ndonc xf_2 = " + str(n2-xmax_1) + " mol")
    else:
        print("\nLe réactif limitant est\nle 2nd avec xmax = " + str(xmax_2) + " mol\
            \ndonc xf_1 = " + str(n1-xmax_2) + "mol")

if nbr_react == 3:
    if xmax_1 == xmax_2 == xmax_3:
        print("\nLa réaction est totale\nxmax = " + str(xmax_2))
    elif xmax_2 > xmax_1 and xmax_3 > xmax_1:
        print("\nLe réactif limitant est\nle 1er avec xmax = " + str(xmax_1) + " mol\
            \ndonc xf_2 = " + str(n2-xmax_1) + " mol\net xf_3 = " + str(n3-xmax_1) + " mol")
    elif xmax_1 > xmax_2 and xmax_3 > xmax_2:
        print("\nLe réactif limitant est\nle 2ème avec xmax = " + str(xmax_2) + " mol\
            \ndonc xf_1 = " + str(n1-xmax_2) + " mol\net xf_3 = " + str(n3-xmax_2) + " mol")
    else:
        print("\nLe réactif limitant est\nle 3ème avec xmax = " + str(xmax_3) + " mol\
            \ndonc xf_1 = " + str(n1-xmax_3) + " mol\net xf_2 = " + str(n2-xmax_3) + " 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.