We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 9
@ What ts Data Spucture? rene
eK xganizing _ managing and stoving data i
@ WPes of data Stvuctuyes In Ourhon :-
ATA STRUCTURE a
[Python has Impucit supposr for data structures
|_| which enabies you to _stOve £ access id ote enn————— | Lara
__ Lists ave used to stove data of different data
types In a sequential manney and -theve ave
Y
into tt accordingly.
Eiri Geese
Myalist=f1,2.3," 132] 3 data
print (my. list) 4
OUicueael NOTES ne {rea
£1,2,3, example’, 2.132].
12,3,(example’, 3.132, 10, 301]
eis my as ts) 4€ delere element at index S.
I palotC my list)
E pop element From tst=e
— Output C1,.2,3, ‘example 43.132, 20].
Ck 3 Hi 82), i.
po oroeeedeclement 2
pe A
ccessing element, you ___
| should pass the index values and hence can
obtain value - _
ist=01,2,3,‘example’ , 2-132, 10, 30]
ifoy @)
pyint (element)
ist :3F Qecess one b
example
aw Jeri
ef 10 a i
eh 20) § i
11,2,3, ‘example’, 3.13 132, 10, 30)
Reeerriotat ui F
me (0 wae ict sec
Bei couior. ce 2a) example’ aeI pi ee
[Thples ave same ae lists ave yulth the exception |
_| that the data once entered into the tuple
cannot be changed no matter what. ‘
ccessing elements ts
the same as it is fev accessing
_values tn Ifsts-
muy. tuple 2=(1,2,3, ‘python’) 4 accessing elements
fox in_my_ tuple 2:he On, a
NOTES GALLERY (TELEGRAM),function and pass
the vdlue to if.
Cpe ale pe
mu. Set. add (4) + add element to set.print (my- ee)
my—dict = ae 2s fracas’ «: cade
NOTES GALLERY (revecenny.
mova ta
2 t av.
ict. pop (‘Third’) 4
Te ‘value’: a.)
px int “Dictionary” tomy. diet)
Continue ==>
8+|_N@jue : Ruby ; ;
—|| __ Dictionary : ai Python’, 2: “Javed
Key, value paty: (2, ‘Java’)
retrieving the values -
muy dict = { “Fixct?: “eython” ‘Second’: ‘code’ F
print (my. dict C* First ?]) +: access u Ing Key
paint (my dict. get (‘second ))
3k Qccess elements using Bet.