Page 27 - Python Cơ Bản
P. 27
numbers = [1, 2, 3]
numbers.append(4)
print numbers
(HiӅn thӍ [1, 2, 3, 4]
0ϴ] TL϶R Xм GYРM QϲRK
2ЎY QYРR Pϴ] TL϶R Xм GYРM GɽRK GжE QϲRK VE OLОM QϲRK
Gɹ XLВ Wм HдRK TLRK XLиG list.pop() WЌ XVϲ ZА KMɨ XVК
GжE TL϶R Xм GYРM GɽRK Zɧ QϲRK Fɩ] KMЬ WЌ OLɺRK GɸR TL϶R
Xм Rɧ]
numbers = [1, 2, 3]
mynumber = numbers.pop()
print mynumber
(HiӅn thӍ 3)
print numbers
(HiӅn thӍ [1, 2])
8ɳQ QШX KMɨ XVК XVSRK QϲRK
2ЎY FϰR QYРR XɳQ ZК XVɴ MRHI\ GжE QШX KMɨ XVК XVSRK QШX