There's no way for one process to directly set an environmental value inside another. Your script can only set the variable from inside itself, although it is possible to receive the value from the outside.
This means you have to run the command as a sub-process of the script, using
command substitution or similar, or else have it output the value to an external file or named pipe, and it's up to the script to figure out how to extract it from there.
Now, the shell
can do
integer-based math internally, but as you are aware it can't handle floating-point values. For those, you have to use an external process. Most scripters use
bc or
awk for that. If you really want to use your python command as the calculator, just substitute it for one of these other processes.
How can I calculate with floating point numbers instead of just integers?
http://mywiki.wooledge.org/BashFAQ/022