[Tutor] Invalid syntax (pyflakes E)
Chris Barnes
chris.barnes.clb at gmail.com
Tue Jul 13 11:17:45 EDT 2021
Below is my code. I'm a student in Programming for Engineers and I'm
having trouble with some syntax errors. I've highlighted in yellow where
I'm having the issue. Any help would be appreciated.
import pint;
def GetInputFromArray(promt, choices):
print(prompt)
for i in range(0, len(choices)):
print("Enter {} for {}".format(i, choices[i]))
selection = int(input("Enter Value: "))
return choices[selection]
a = GetInput("Select Pressure", ["atm", "in_Hg", "psi"])
print("You selected: {}".format(a))
v = 1.0
from pint import UnitRegsitry
ureg = UnitRegistry()
v = v * ureg.parse_expression(a)
print(" Here is the value with units {}".format(v))
print(v.to(ureg.atm))
print(v.dimensionality)
ureg = UnitRegistry(autoconvert_offset_to_baseunit = True)
def getPressureInAtm():
print("You will input the pressure value and then select the units of
the input")
p = float(input("Enter Pressure:"))
choices = ["atm"", "in_Hg", "psi"]
print("Youl will now select the units of the value entered")
for i in range(0, len(choices)):
print("Enter {} for {}".format(i, choices[i]))
units = int(input("Enter Value: "))
p1 = p * u.parse_expression(choices[units])
print(getPressureinAtm())
Thanks,
Chris Barnes
More information about the Tutor
mailing list