SHARE
TWEET

Untitled

a guest Oct 21st, 2019 74 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. word = input()
  2.  
  3. lower_case = [char for char in word if char.islower()]
  4. upper_case = [char for char in word if char.isupper()]
  5. digit_odd_case = [char for char in word if char.isdigit() and int(char) % 2]
  6. digit_even_case = [char for char in word if char.isdigit() and int(char) % 2 == 0]
  7.  
  8. lower_case = ''.join(sorted(lower_case))
  9. upper_case = ''.join(sorted(upper_case))
  10. digit_even_case = ''.join(sorted(digit_even_case))
  11. digit_odd_case = ''.join(sorted(digit_odd_case))
  12.  
  13. print(lower_case + upper_case + digit_odd_case + digit_even_case)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top