Sort by

recency

|

1070 Discussions

|

  • + 0 comments

    s = input()

    lowercase = sorted([c for c in s if c.islower()]) uppercase = sorted([c for c in s if c.isupper()]) odd = sorted([c for c in s if c.isdigit() and int(c)%2 !=0]) even = sorted([c for c in s if c.isdigit() and int(c)%2 ==0])

    sorted_s = ''.join(lowercase+uppercase+odd+even) print(sorted_s)

  • + 0 comments

    name = input() sorted_data = ''.join(sorted(name,key=lambda x:( x.isdigit(), x.isdigit() and int(x)%2==0, x.isupper(), x ))) print(sorted_data)

  • + 0 comments
    s.sort()
    
    lowercase = uppercase = odd = even = ""
    
    for letter in s:
        if letter.isnumeric():
            odd += odd.join(letter) if int(letter) % 2 == 0 else ""
            even += even.join(letter) if int(letter) % 2 == 1 else ""
        else:  
            lowercase += lowercase.join(letter) if letter.islower() else ""
            uppercase += uppercase.join(letter) if letter.isupper() else ""
    
    print(lowercase, uppercase, even, odd, sep="")
    

    That's it

  • + 0 comments
    S = input()
    R = []
    R.extend(sorted(x for x in S if x.islower()))
    R.extend(sorted(x for x in S if x.isupper()))
    R.extend(sorted(x for x in S if x.isnumeric() and int(x) % 2 == 1))
    R.extend(sorted(x for x in S if x.isnumeric() and int(x) % 2 == 0))
    print(''.join(R))
    
  • + 0 comments
    import re
    string=input()
    lc=re.findall(r'[a-z]',string)
    uc=re.findall(r'[A-Z]',string)
    num=re.findall(r'[0-9]',string)
    od=[ i for i in num if int(i)%2!=0]
    ev=[ i for i in num if int(i)%2==0]
    print(*sorted(lc),*sorted(uc),*sorted(od),*sorted(ev),sep="")