#Gas Equation - An equation used in physics and chemistry that relates pressure, volume, and temperature of a gas is PV = nRT.
#P is the pressure
#V = Volume
#T = Temperature
#n = number of moles
#R = a constant
# The function outputs the tempature of a gas given the other values
gas_constant = 8.3144621 #Joules / (mol*Kelvin)
def convert_to_temp(pressure, volume, mols):
"""Convert pressure, volume, and moles to a tempature"""
return (pressure * volume) / (mols * gas_constant)
press = float(input('Enter pressure (in Pascals):'))
vol = float(input('Enter volume (in cubic meters):'))
mols = float(input('Enter number of moles: '))
print(f 'Tempature = {convert_to_temp(press, vol, mols):.2f} K')
To embed this project on your website, copy the following code and paste it into your website's HTML: