Câu hỏi của Nguyen Minh

Hỏi về độ dài trong Python

f = open("SERIE.INP","r") line1=f.readline() list_input=[int(num) for num in line1.split()] h=len(list_input) n=list_input[h-h] k1=list_input[h-2] k2=list_input[h-1] s=str(f.readline()) t=str(f.readline()) print len(s) print len(t) f.close() File SERIE.INP 5 3 2 0 1 0 0 0 0 0 0 1 1 Cho e ...

Nguyen Minh viết 13:43 ngày 01/10/2018 chỉnh sửa

Vấn đề về file trong Python

Code Python : f = open("SERIE.INP","r") line1=f.readline() list_input=[int(num) for num in line1.split()] n=list_input[0] k1=list_input[1] k2=list_input[2] File txt: 5 2 3 Cho e hỏi tại sao lúc chạy nó lại báo lỗi k1=list_input[1] List index out of range

Nguyen Minh viết 13:43 ngày 01/10/2018 chỉnh sửa
1