# Wrong Division Operation in Python Script

**URL:** <https://forum.dynamobim.com/t/wrong-division-operation-in-python-script/58075>\
**Category:** Developers\
**Tags:** python, dynamo, mathematica\
**Created:** [December 7, 2020, 9:18pm UTC](https://forum.dynamobim.com/t/wrong-division-operation-in-python-script/58075 "2020-12-07T21:18:16Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Luiscko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/luiscko/32/104053_2.png) [@Luiscko](https://forum.dynamobim.com/u/Luiscko)\
**Post date:** [December 7, 2020, 9:18pm UTC](https://forum.dynamobim.com/t/wrong-division-operation-in-python-script/58075/1 "2020-12-07T21:18:17Z")

</div>

Hello everyone I was checking why my code does not do and offset that I was writing in the code and I find this thing, do you know why in the python script is not doing any simple division right, I am doing something wrong?.

 ![image](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/e/b/ebb0845546849d7b1dd1435df49680ad376aa2e9.png)

```
# The inputs to this node will be stored as a list in the IN variables.
OFacade = IN[0]
GridO= IN[1]
RefDist = 25
#Obtain curve on the bottom surface for form

EscFloor= float(((RefDist-(OFacade/100))/RefDist))

#Form for Grid Geometry
EscSGrid= ((RefDist-((OFacade+GridO)/100))/RefDist)
	
# Assign your output to the OUT variable.
OUT = EscFloor, EscSGrid,(OFacade/100)
```

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [December 7, 2020, 9:36pm UTC](https://forum.dynamobim.com/t/wrong-division-operation-in-python-script/58075/2 "2020-12-07T21:36:07Z")

</div>

Try adding a .0 on the RefDist and 100. I have seen behavior like this before and the single decimal should force the a double.

---

<div class="post-metadata">

**Author:** ![Luiscko](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/luiscko/32/104053_2.png) [@Luiscko](https://forum.dynamobim.com/u/Luiscko)\
**Post date:** [December 7, 2020, 9:44pm UTC](https://forum.dynamobim.com/t/wrong-division-operation-in-python-script/58075/3 "2020-12-07T21:44:59Z")

</div>

You are totally right thanks, with that now is working 😀

---

<div class="post-metadata">

**Author:** ![Michael\_Kirschner2](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/michael_kirschner2/32/75576_2.png) [@Michael\_Kirschner2](https://forum.dynamobim.com/u/Michael_Kirschner2)\
**Post date:** [December 7, 2020, 11:01pm UTC](https://forum.dynamobim.com/t/wrong-division-operation-in-python-script/58075/4 "2020-12-07T23:01:05Z")

</div>

this is a python 2 vs python 3 thing.

> <https://stackoverflow.com/questions/21316968/division-in-python-2-7-and-3-3>

---

<div class="post-metadata">

**Author:** ![SeanP](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/seanp/32/42560_2.png) [@SeanP](https://forum.dynamobim.com/u/SeanP)\
**Post date:** [December 7, 2020, 11:16pm UTC](https://forum.dynamobim.com/t/wrong-division-operation-in-python-script/58075/5 "2020-12-07T23:16:18Z")

</div>

Thanks for the background, ran into this originally in C# quite a while back and just about went crazy!! Now I use the decimal no matter what just to be safe!
