1print(bytearray(4))
2a = bytearray([1, 2, 200])
3print(type(a))
4print(a[0], a[2])
5print(a[-1])
6print(a)
7a[2] = 255
8print(a[-1])
9a.append(10)
10print(len(a))
11
12s = 0
13for i in a:
14    s += i
15print(s)
16
17print(a[1:])
18print(a[:-1])
19print(a[2:3])
20
21print(str(bytearray(b"123"), "utf-8"))
22
23# Comparisons
24print(bytearray([1]) == bytearray([1]))
25print(bytearray([1]) == bytearray([2]))
26print(bytearray([1]) == b"1")
27print(b"1" == bytearray([1]))
28print(bytearray() == bytearray())
29
30# comparison with other type should return False
31print(bytearray() == 1)
32
33# TODO: other comparisons
34
35# __contains__
36b = bytearray(b"\0foo\0")
37print(b"foo" in b)
38print(b"foo\x01" in b)
39print(b"" in b)
40