Just get what i see, how?

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