Behaviour of collection data type
> there are two type of data type
1. Mutable data type
2. immutable data type
1. mutable data type : The data in wehich we can modify their value space called
mutable data type
> there are 3 types of collection dsta type
1. list
2. set
3. Dictionary
>syntax for modify : variablename [index_possition]= new_value
>syntax for delete : del variablename[index_possition]
[Link] data types : the data in which we can't modyfy there value space thats
call immutable data types
> there are 3 types data
1. All single value data type
[Link] data type
. integer
. float
. complex
[Link] data type
.true
.false
2. string
[Link]
>>>>LIST::
>list is a both homogenious and heterogenious data type in which each and
evry element is separeted by comma(,) and enclosed ina squre bracket ([])
>List is a mutable data type .
>List is a order collection data type .
>In list indexing and slicing is possible.
>List is a varible lenght data type because it is a mutable data type.
> syntax:>variablename[e1,e2,e3,e4,...en]
Examples : L= [10,20,39,45,89]
len(L)
5
type (L)
<class 'list'>
L[1]
20
L[3]
45
L[-1]
89
L[1:4:]
[20, 39, 45]
L[::-2]
[89, 39, 10]
L[::2]
[10, 39, 89]
L[::-1]
[89, 45, 39, 20, 10]
del L[3]
L
[10, 20, 39, 89]
L[1]=12
L
[10, 12, 39, 89]
>>>>SET::
>Set is both homo genious and hetero genious collection data type in which
each and every elements is saparate by comma(,)and enclosed in a carlibracess({})
>it is a mutable data type
>>>>DICTIONARY::
>Dictionary is order collection data type of key and values pair.
>In case of dictionary key and values are enclosed by comma(,).
>The kye and values are separate by (:)
>dictionary is mutable data types
>as the data is form of pair we can't perform modyfy or slicing
Syntax: variablename{keyname:valname,keyname:valname....}
PROPOTIES OF KEY >>
> we can use only immutable data type in key values.
> key are case sentivite
> if we add the duplicate key values then recent value assign to that key.
PROPOTIES OF VALUES >>
> We can use duplicate value in dictionary
> We can use any type of data in values