SimeonTs

SUPyF2 Text-Processing-Lab - 05. Digits, Letters and Other

Oct 26th, 2019
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.78 KB | None | 0 0
  1. """
  2. Text Processing - Lab
  3. Check your code: https://judge.softuni.bg/Contests/Practice/Index/1739#4
  4.  
  5. SUPyF2 Text-Processing-Lab - 05. Digits, Letters and Other
  6.  
  7. Problem:
  8. Write a program that receives a single string and on the first line prints all the digits,
  9. on the second – all the letters, and on the third – all the other characters.
  10. There will always be at least one digit, one letter and one other characters.
  11. Examples
  12. Input               Output
  13. Agd#53Dfg^&4F53     53453
  14.                    AgdDfgF
  15.                    #^&
  16. """
  17. string = input()
  18. print(''.join([letter for letter in string if letter.isdigit()]))
  19. print(''.join([letter for letter in string if letter.isalpha()]))
  20. print(''.join([letter for letter in string if not letter.isdigit() and not letter.isalpha()]))
Add Comment
Please, Sign In to add comment