猫史档案馆


【猜测】你猜猜我用什么编程语言写的这些代码,我要来干什么。

用户:KIHIOKIHIO查看:1 回复:1 评论:1 创建时间:2021-08-14T13:42:13


error1=False
try:
    n=input()
except EOFError:
    print('Error')
    error1=True
if not(error1):
    if n[0]==',' or n[len(n)-1]==',':
        print('Error')
    else:
        i=0
        tn=[]
        lx=0
        jj=' '
        error2=False
        while i<len(n):
            sfd=False
            try:
                cs=int(n[i])
            except ValueError:
                if n[i]!=',':
                    print('Error')
                    error2=True
                    break
                sfd=True
                lx+=1
                if lx==2:
                    print('Error')
                    error2=True
                    break
            if not(sfd):
                lx=0
            if sfd:
                try:
                    tn.append(int(jj))
                except ValueError:
                    continue
                jj=' '
            elif jj==' ':
                jj=n[i]
            else:
                jj=jj+n[i]
            i+=1
        if not(error2):
            tn.append(int(jj))
            while True:
                i=0
                yx=True
                while i<len(tn)-1:
                    if tn[i]>tn[i+1]:
                        hc=tn[i]
                        tn[i]=tn[i+1]
                        tn[i+1]=hc
                        yx=False
                    i+=1
                if yx:
                    break
            i=0
            s=' '
            while i<len(tn):
                if s==' ':
                    s=str(tn[i])
                else:
                    s=(s+',')+str(tn[i])
                i+=1
            print(s)


回复

上一页1 页 / 共 1下一页
cmdelinecmdeline

Python

点赞0


评论