Wenzel Jakob | 5708221 | 2015-09-04 23:42:12 +0200 | [diff] [blame] | 1 | #!/usr/bin/env python |
| 2 | from __future__ import print_function |
Wenzel Jakob | 38bd711 | 2015-07-05 20:05:44 +0200 | [diff] [blame] | 3 | import sys |
| 4 | sys.path.append('.') |
| 5 | |
| 6 | from example import Sequence |
| 7 | |
| 8 | s = Sequence(5) |
| 9 | print("s = " + str(s)) |
| 10 | print("len(s) = " + str(len(s))) |
| 11 | print("s[0], s[3] = %f %f" % (s[0], s[3])) |
| 12 | print('12.34 in s: ' + str(12.34 in s)) |
| 13 | s[0], s[3] = 12.34, 56.78 |
| 14 | print('12.34 in s: ' + str(12.34 in s)) |
| 15 | print("s[0], s[3] = %f %f" % (s[0], s[3])) |
| 16 | rev = reversed(s) |
| 17 | rev2 = s[::-1] |
| 18 | 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])) |
| 19 | |
| 20 | for i in rev: |
| 21 | print(i, end=' ') |
| 22 | print('') |
| 23 | for i in rev2: |
| 24 | print(i, end=' ') |
| 25 | print('') |
| 26 | print(rev == rev2) |
| 27 | rev[0::2] = Sequence([2.0, 2.0, 2.0]) |
| 28 | for i in rev: |
| 29 | print(i, end=' ') |
| 30 | print('') |