Advertisement
nanokatka

collections1

Feb 17th, 2020
115
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.61 KB | None | 0 0
  1. """
  2. 1. User enters a string. Program must print out a string of all the
  3. unique symbols except white spaces, ordered by default. Program must
  4. be case-insensitive.
  5.  
  6. Example:
  7. String: My name is Alex
  8. Result:
  9. aeilmnxy
  10.  
  11. NOTE: you will need a few data structure transformations here.
  12. """
  13.  
  14. text=input("Enter text:")
  15. text=text.lower()
  16. newtext=[]
  17. for letter in text:
  18. if (letter not in newtext) and (letter != ' ') and (letter != '\t') and (letter != '\v'):
  19. newtext.append(letter)
  20. else:
  21. pass
  22. newtext.sort()
  23. newtext2=''
  24. for item in newtext:
  25. newtext2=newtext2+item
  26. print(newtext2)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement