This function I did to improve calculator program by eliminating problems with Pythons problem of dividing integer with integer and giving integer division result.

```
def endswithint(s):
return not s.rstrip('0123456789').endswith('.')
def addpoint(s):
""" returns '.' if s ends with integer, nothing if it endswith float """
if endswithint(s): return '.'
return ""
a="2+1"
b="3"
print eval(a+'/'+b) # integer division
print eval('1.0*'+a+'/'+b) ##also does not make it
a+=addpoint(a)
print eval(a+'/'+b)
```

About the Author

IT Pro doing Eng-Fin-Eng translations