OTHER DATATYPES: ================ Frozen sets =========== inbuilt datatype class: "frozenset" frozenset(): =========== we can define the frozenset from other collections like: list, strings, tuple, sets, dictionaries etc. Syntax: identifier = frozenset(any collection) # creation of frozen sets a = frozenset("Object Oriented") b = frozenset([111,222,333,444,555]) c = frozenset((1,3,5,7,9)) d = frozenset({10,20,30,40,50,60}) e = frozenset({'a':11,'b':22,'c':33,'d':44}) f = frozenset({1212,2323,3344,4545}) # g = frozenset(1122,1212,1234,12345) print(type(a),type(b),type(c),type(d),type(e)) print(type(f)) print(a) print(b) print(c) print(d) print(e) print(f) ========================= Features: ======== 1) Collection datatype 2) Index is not supported. 3) Not ordered. 4) Duplication is not allowed. 5) Immutable datatype. Byte datatypes ============== 1 byte ==> 8-bits used to store the values of: 2^8 ==> 256 values ranged from: 0 to 255 ==> byte datatype can allow to define with the values are from only 0 to 255. ==> two types: bytes datatype byte array datatype bytes datatype =============== bytes(): ======= we can define the bytes datatype from any collection. ==> an inbuilt datatype Syntax: identifier = bytes(any collection) # a = bytes("12345") string to bytes not possible """ string ===> bytes not possible Unicode ==> 0 to 65535 "12345" "1" ==> 48 """ a = bytes([1,11,111,101,112]) b = bytes((0,10,20,30,40)) c = bytes({11:111,12:122,13:134}) print(a);print(b);print(c) print(type(a));print(type(b),type(c)) =========================== features: ========= 1) Collection 2) bytes data can store in the memory with hexadecimal characters. 3) index can be supported. 4) Ordered. 5) Immutable datatype. Byte Array Datatype: ==================== bytearray() Syntax: identifier = bytearray(any collection) ==> mutable datatype. a = bytearray([10,20,30,40,50]) print(a) print(type(a)) print(id(a)) print(a[0]) print(a[-1]) print(a[::-1]) a[2] = 112 print(a) print(id(a))