Script code for Divi theme

I have a question and I would like to to solve it.

I am using Divi theme and I need to make simple calculation and to use same variables inside article that is built with Divi theme. ANd it should not affect the website speed, crawling or anything else.

The calculation is like this as an example:
$number_1 = 0;
$celsius = 25;
$fahrenheit = ($celsius * 9/5) + 32;

This is the article content where I want to use these variables:

I am using temperature $celsius and it is really hot compared to $number_1 temperature. But, if you want to know what $celsius temperature is in fahrenheit then you would use simple calculation. And you would get that $celsius C temperature is $fahrenheit F.

$number_1 is normal temperature for a human.

So, I want to define a variable at the start of the article and I want to use those variable inside article when I need, and second is that I want to use variable defined at the start to make calculation when needed inside article.
I want to avoid repeating the same value throughout the article manually if I can do it with a code at the begining.

Do you know to accomplish this inside Divi:

  1. define variable in the article
  2. use that variable inside article when needed
  3. use variable in calculation when needed and show result when needed by uing variables?

Is it by using script at the begining inside code window and then later use those variables or something else?
Each page would have its own variables value which I would change when needed so it is not global variable that I need to use in each page.

This is what I have used with id. But I need to use same variable many times in the article so I need variable that can be used more than once.
I think something with class would help instead using ID.

Hello, my name is

Hello, my name is Nathan

Hello Nathan

Nice to meet you. As per your requirements and shared scope on work i must say that it will be a custom script. Please connect with me via envato profile email so we could discuss more on the work.

Looking forward to hearing from you.