You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
725 B

  1. #!/usr/bin/env python
  2. from __future__ import print_function
  3. import sys
  4. sys.path.append('.')
  5. from example import Sequence
  6. s = Sequence(5)
  7. print("s = " + str(s))
  8. print("len(s) = " + str(len(s)))
  9. print("s[0], s[3] = %f %f" % (s[0], s[3]))
  10. print('12.34 in s: ' + str(12.34 in s))
  11. s[0], s[3] = 12.34, 56.78
  12. print('12.34 in s: ' + str(12.34 in s))
  13. print("s[0], s[3] = %f %f" % (s[0], s[3]))
  14. rev = reversed(s)
  15. rev2 = s[::-1]
  16. print("rev[0], rev[1], rev[2], rev[3], rev[4] = %f %f %f %f %f" % (rev[0], rev[1], rev[2], rev[3], rev[4]))
  17. for i in rev:
  18. print(i, end=' ')
  19. print('')
  20. for i in rev2:
  21. print(i, end=' ')
  22. print('')
  23. print(rev == rev2)
  24. rev[0::2] = Sequence([2.0, 2.0, 2.0])
  25. for i in rev:
  26. print(i, end=' ')
  27. print('')