Just get what i see, how?

Hello,

i just combine values with strings, so can i get what i see in the smoothes way. without any error potential

for any reason in creats digits during convertion!

KR

Andreas

Hi,

I think this is just a behavior with doubles, easiest solution would be to convert it to an integer and than to a string.

Hope this helps.
Kind regards

2 Likes

Hi, here is a version, I know that M. c. Poupin or M. v Kuzev had written something more elegant but I can’t find the post (general case)

import sys
a=IN[0]
arr_str=[]
for n in a:
    if isinstance(n,int):
        arr_str.append(str(int(n)))
    else:
        m=str(n).split('.')
        p=str(int(m[1][::-1]))
        arr_str.append(m[0]+','+p[::-1])

OUT = arr_str

edit: this one below will work better

import sys
import math
a=IN[0]
arr_str=[]
for n in a:
    if (math.floor(n)-n)==0 or (math.ceil(n)-n)==0:
        arr_str.append(str(int(n)))
    else:
        m=str(n).split('.')
        p=str(int(m[1][::-1]))
        arr_str.append(m[0]+','+p[::-1])

OUT = arr_str

Have a good evening
cordially
christian.stan

3 Likes