Ask Your Question

What is the meaning of string index out of range?

asked 2016-12-04 06:45:49 -0500

Nilesh gravatar image

updated 2017-01-08 05:06:04 -0500

FrédéricC gravatar image

I am dealing with [35,6] linear code over finite filed with 2 elements. I am able to get an output of its generator matrix as 6x35 matrix, but while computing parity check matrix which will be of size 29x35, I am getting following output: IndexError:string index out of range

Does it mean that its size is two large? If still it is so, how to get that matrix in sage??

edit retag flag offensive close merge delete


Could you please provide the full code that lead to the error ?

tmonteil gravatar imagetmonteil ( 2016-12-04 07:00:58 -0500 )edit

1 answer

Sort by » oldest newest most voted

answered 2016-12-04 07:15:38 -0500

tmonteil gravatar image

ithout further information on your concrete use case, such an error appears when you asks for the letter of a string at an index that is larger than the length of the string:

sage: s = 'abc'
sage: s[0]
sage: s[1]
sage: s[2]
sage: s[3]
IndexError: string index out of range
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools


Asked: 2016-12-04 06:45:49 -0500

Seen: 37 times

Last updated: Dec 04 '16