Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

I need help with my Python scripting to work, I dont know where to start to get

ID: 3765032 • Letter: I

Question

I need help with my Python scripting to work, I dont know where to start to get it working. Heres the instructions. I am at a lost. Thank you for your help in advance!

You will complete a program that calculates the volume of a gas (Oxygen (02) is assumed), using a formula known as the ideal gas law, given the following input:

Input: Grams of o2

Input: Temperature in degrees C

The program should then provide output in the following format.

The volume of 32.00 grams of O2

at 0.00 degrees C

and 1.00 atmospheres

is 22.43 liters.

Calculations

The ideal gas law is expressed as:     P*V = N*R*T

P equals pressure in atmospheres (1 atmosphere = pressure at sea level)

V = volume in liters. (This is what the program must calculate.)

N = the quantity of gas, expressed in moles. For o2, moles = grams / 32

R = a gas law constant, 0.0821

T = temperature expressed in Kelvin. Kelvin is calculated as K = degrees C + 272.15

The program will prompt the user for grams of o2, and the temperature in C.

For N, Grams must be converted to moles as shown for “N” above. For T, your Celcius input must be converted to Kelvin as shown above. Assume P = 1 and R equals 0.0821.

With your converted units, calculate for volume. Solving for V, the ideal gas law becomes

V = (N * R * T) / P

##
# This program is for calculating the volume of an amount of oxygen (o2)
# at a given temperature, assuming sea level pressure.
#
#

def main () :
# get input
grams = inputo2() # you will write this function
tempC = inputTemperatureInc() # you will write this function
p = 1 # assume one atomsphere (sea level)


# convert units to metrics SI unots as specified in instructions
T = 0 # fix this
N = 0 # fix this


# perform calculations
voulme = calcGasVol (N,T,P) # you will write this function

print ("The Volume of %.2f g 02 " % grams)
print("at % .2f C " % tempC)
print("and % .2f atmospheres is " % P )
print("%.2f liters." % volume)


def input02 () :
# you will write this function
# prompt the user to enter a number of grams of 02
# the input must be greater than 0
# return the temperature

def inputTemperatureInC ():
# you will write this function
# prompt the usr to enter a temperature.
#the input must be greater than -273.25 ( minus 273.15)
# Loop until good data is entered
# return the temperature entered

def calcGasVol (N,T,P):
# you will write this function
# N = moles, T = temperature K, P = pressure in atmospheres
# Calculate and return volumes based on the gas law in the instructions
#return volume


if _name__=="__main__":
  

Explanation / Answer

Python code:

import math
def main () :
# get input
   grams = inputo2()     # you will write this function
   tempC = inputTemperatureInc()    # you will write this function
   p = 1     # assume one atomsphere (sea level)

   # convert units to metrics SI unots as specified in instructions
   T = 0    # fix this
   N = 0    # fix this
   P = 1

# perform calculations
   volume = calcGasVol (N,T,P)   # you will write this function
   print ("The Volume of %.2f g 02 " % grams);
   print("at % .2f C " % tempC)
   print("and % .2f atmospheres is " % P )
   print("%.2f liters." % volume)

def inputo2():
# you will write this function
# prompt the user to enter a number of grams of 02
# the input must be greater than 0
# return the temperatur
   N=float(input("Enter radius: "))
   if N>0:
      return N


def inputTemperatureInc():
# you will write this function
# prompt the user to enter a temperature.
#the input must be greater than -273.25 ( minus 273.15)
# Loop until good data is entered
# return the temperature entered
   T=float(input("Enter Temperature: "))
   if T>-273.25:
       return T

def calcGasVol(N,T,P):
# you will write this function
# N = moles, T = temperature K, P = pressure in atmospheres
# Calculate and return volumes based on the gas law in the instructions
#return volume
   T = T+272.15
   N = N/32
   R = 0.0821
   return (N*R*T)/P
if __name__ == '__main__':
   main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote