I am trying to ask for a float variable, then assign its scientific notation to it and then use that notation in the following operations. As in, I want the program to actually work with the notation, not just return the results in it. I managed to convert variable by using the print function:
def estim(abs(x)):
a=print("{:.3e}".format(x))
return a
However that does not actually assign the scientific value to x. I then tried
b=float(a)
but a is None type, so it doesn't work. Any help?
Edit: by scientific notation I mean X.YYYe+Z, example: 31234.34234 -> 3.12e+04
a="{:.3e}".format(x)will work?floats don’t internally work using “decimal notation” or “scientific notation.” These are only output formats. What do you mean by “work with the notation”?31234.34234 -> 3.12e+04... You needa="{:.2e}".format(x)and nota="{:.3e}".format(x). (Now don't edit)