Page 23 - Python Cơ Bản
P. 23
8VSRK RLMАY XVЬRK LвT FϰR QYРR XVY] \YϴX QШX TL϶R Xм
FϴX OΧ HрE ZɧS MRHI\ GжE QϲRK XLɳ RЎY XVY] \YϴX чЎR QШX
TL϶R Xм OLɺRK XТR XϰM XLɳ иRK HдRK WЌ FɨS PЦM (S чɹ XVЪG
OLM XVY] \YϴX QШX TL϶R Xм FϰR G϶R OMВQ XVE \IQ TL϶R Xм
Rɧ] чɪ XТR XϰM LE] GLE ,MЖR XϰM T]XLSR OLɺRK LЦ XVв LɧQ
RɧS чВ OMВQ XVE Wр XТR XϰM GжE QШX TL϶R Xм XVSRK QϲRK
'ɹ GɨGL XLЬRK XLϴ] чВ OMВQ XVE чɹ Pɧ Ű0SSO FIJSVI ]SY
PIETű 0&=0 Zɧ Ű)EWMIV XS EWO JSVKMZIRIWW XLER
TIVQMWWMSRű )%*4
:ɴ Hд ZА Ű0SSO FIJSVI ]SY PIET 0&=0 ű
if index < len(array):
array[index]
else:
# handle this
:ɴ Hд ZА Ű)EWMIV XS EWO JSVKMZIRIWW XLER TIVQMWWMSRű
)%*4