t903.py 629 B

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. import collections
  2. try:
  3. print collections.Counter(3)
  4. except TypeError as e:
  5. print e
  6. c = collections.Counter('hello')
  7. try:
  8. print c.elements(5)
  9. except TypeError as e:
  10. print e
  11. try:
  12. print c.most_common(2, 5)
  13. except TypeError as e:
  14. print e
  15. try:
  16. print c.most_common('hello')
  17. except TypeError as e:
  18. print e
  19. print c.most_common(-5)
  20. print c.most_common(200)
  21. try:
  22. c.update(1, 3)
  23. except TypeError as e:
  24. print e
  25. try:
  26. c.update(13)
  27. except TypeError as e:
  28. print e
  29. try:
  30. c.subtract(4, 5)
  31. except TypeError as e:
  32. print e
  33. try:
  34. c.subtract(12.4)
  35. except TypeError as e:
  36. print e