Code erros | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

Code erros

#I am confused on the errors I am running into. I Would be thankfull if someone helped me out. global p1,v1,p2,v2 import cmath import math def getinput(): p1 = input("what is the initial pressure value?") v1 = input("what is the initial volume?") p2 = input("what is the final pressure?") v2 = input("what is the final volume?") return(getinput() import math import cmath global p1,v1,p2,v2 def equation(getinput): equation == (p1*v1 / p2*v2) print(equation) return(getinput()) def none(equation): if p1 == "none": equation = p1 = (v1)/(p2*v2) else: equation = (p1*v1)/(p2*v2) if v1 == "none": equation = v1 = (p1)/(p2*v2) else: equation = (p1*v1)/(p2*v2) if p2 == "none": equation = p2 = (p1*v1)/(v2) else: equation = (p1*v1)/(p2*v2) if v2 == "none": equation = v2 = (p1*v1)/(p2) else: equation = (p1*v1)/(p2*v2) print(equation)

27th Apr 2019, 10:14 PM
Jordan
3 Antworten
0
Can you post the error you are getting? :) It looks like there is a lot of duplicat code in there.
27th Apr 2019, 10:23 PM
Dragonxiv
Dragonxiv - avatar
0
One error i'm getting is a syntax error in line 13. When I use my code in another programing environment, such as jupyter notebook, I get no errors. The only issue I run into is when I run the equation function, the answer is always 0.
27th Apr 2019, 10:42 PM
Jordan
0
You seem to be using return outside of a function. And getinput() doesn't return anything explicitly, so it'll just return None. Your indentation also seems to be wrong. You don't need to import math etc. several times. global outside of a function doesn't make sense. Please upload your code to the code playground and post a link
28th Apr 2019, 4:02 AM
Anna
Anna - avatar