physicsup.py

Created by mino-1289

Created on February 24, 2021

488 Bytes

Solveur de PV = nR*T et de rho = m/V. Il suffit de mettre la valeur recherché dans la fonction par une chaine de caractère. Ex : pvnrt(1E5, ‘x’,1,273.15) va vous donner le volume d’une mole à 1000 hecto-pascal et à 273.15K (0°C). Même fonctionnement pour [rho(m,V,p)]


def pvnrt(P, V, n, T):
    R = 8.31
    if type(P) == str:
        return (n*R*T)/V
    elif type(V) == str:
        return (n*R*T)/P
    elif type(n) == str:
        return(P*V)/(R*T)
    elif type(T) == str:
        return (P*V)/(n*R)
    else:
        return bool(P*V == n*R*T)


def rho(m, V, p):
    if type(m) == str:
        return p*V
    elif type(V) == str:
        return m/p
    elif type(p) == str:
        return m/V
    else:
        return bool(p == m/V)

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.