# python calculator using python variable

**URL:** <https://discourse.paraview.org/t/python-calculator-using-python-variable/3018>\
**Category:** ParaView Support\
**Created:** [November 21, 2019, 2:31pm UTC](https://discourse.paraview.org/t/python-calculator-using-python-variable/3018 "2019-11-21T14:31:54Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![nopech](https://discourse.paraview.org/user_avatar/discourse.paraview.org/nopech/32/2137_2.png) [@nopech](https://discourse.paraview.org/u/nopech)\
**Post date:** [November 21, 2019, 2:44pm UTC](https://discourse.paraview.org/t/python-calculator-using-python-variable/3018/2 "2019-11-21T14:44:50Z")

</div>

Oke, nevermind. The solution came to my mind as soon as I posted this:

Of course if the expression is a string, the float value of my variable has to be converted to a string.  
pCalcQ.Expression = ‘inputs[0].PointData[“U\_Normal”]\*inputs[1].PointData[“density”]\*inputs[2].PointData[“H”]-’ + str(hRef)

Works fine.

Cheers, nopech

---

_[View the full topic](https://discourse.paraview.org/t/python-calculator-using-python-variable/3018)._
