Mutability Vs Immutability: =========================== All primitive datatypes ==> Immutable Datatypes after the definition of the data, the modification is not allowed if the modification is triggered, that modification reserve with new address a = 123 # initeger b = 12.234 # float c = 12-24j # complex d = True # Boolean """ id(): ==> use to get the address of the data Syntax: id(value) """ print(id(a)) print(id(b)) print(id(c)) print(id(d)) a = 1203 b = 0.00097 c = 0.9 + 7.9j d = False print(id(a)) print(id(b)) print(id(c)) print(id(d)) Mutability: =========== after the definition, we can make the change within the original address. Ex: List, dictionary, set etc. Collection Datatypes: ==================== group of values can define with one variable. ex: a = (1,2,3,4) 1) String Datatype: =================== ==> collection of or group of characters which can be enclosed with "single quotes" or "double quotes" called as "string". Ex: 'A' ==> Character In Python: 'a', 'ababab' "a", "aabaaa" ==> String data ==> Inbuilt datatype a pre-defined class ==> "str". ==> Ordered. ==> Sequence based. we can allow to use the index to get the individual elements from the string. python can support: positive indexing: access the string data with positive index values range: 0 to length - 1 can allow to access the characters of string in forward direction (left to right) negative indexing: access the string data with negative index values range: -1 to -length can allow to access the characters of the string in reverse direction (right to left) ==> Slicing is also possible on string data. [start-index: stop-index: step] ==> Immutable datatype. d1 = 'a' d2 = 'abababa' d3 = "a" d4 = "abababbab" d5 = "Python Programming Language" print(type(d1)) print(type(d2)) print(type(d3)) print(type(d4)) print(d2) print(d4) # positive indexing ==> Forward Accessing print(d2[0]) print(d2[1]) print(d2[2]) print(d2[3]) print(d2[4]) print(d2[5]) print(d2[6]) print() # Negative indexing ==> Reverse Accessing print(d2[-1]) print(d2[-2]) print(d2[-3]) print(d2[-4]) print(d2[-5]) print(d2[-6]) print(d2[-7]) print(d5) # slicing print(d5[0:6]) print(d5[:6]) print(d5[::]) print(d5[::1]) print(d5[::-1]) """ if the start-index ==> absent, the slicing can begin with first character (0) by default if the step factor ==> absent, the slicing can be considered with the index difference of '1' by default. if the stop-index ==> absent, the slicing can be considered till the last index by default. """ # d5[1] = 'Y' d6 = d5.upper() print(d5) print(d6)