Oct-31-2019, 10:56 PM
The def code when it results in negative does not work. I don't know how to solve it.
def conversao(x): if x < GPa: return(str(int(x/MPa))+"MPa") elif x >= GPa: return(str(int(x/GPa))+"GPa") GPa=1000000000 MPa=1000000 y=-2*10**9 z=y/2 print(f"{conversao(z)}")The output should be -1GPa and not -1000MPa.