ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 13 Nov 2016 12:09:15 -0600how do change a string of letters into integers using sagecell?http://ask.sagemath.org/question/35559/how-do-change-a-string-of-letters-into-integers-using-sagecell/ I am a high school teacher and I want to change letters into integers. Then, I am taking the numbers into a matrix mXn dimension. I want to show how to multiply matrices to encode a message. Then, decode the message by multiplying by the inverse of a matrix. I know some if any basics using sagemathcell or python. Sun, 13 Nov 2016 11:22:55 -0600http://ask.sagemath.org/question/35559/how-do-change-a-string-of-letters-into-integers-using-sagecell/Answer by ndomes for <p>I am a high school teacher and I want to change letters into integers. Then, I am taking the numbers into a matrix mXn dimension. I want to show how to multiply matrices to encode a message. Then, decode the message by multiplying by the inverse of a matrix. I know some if any basics using sagemathcell or python. </p>
http://ask.sagemath.org/question/35559/how-do-change-a-string-of-letters-into-integers-using-sagecell/?answer=35561#post-id-35561An example:
S = 'my message'
print S
L = list(S)
print L
L_int = [ord(s) for s in L]
print L_int
print [chr(i) for i in L_int]
print ''.join([chr(i) for i in L_int])
print
M = matrix(2,5,L_int)
M
Sun, 13 Nov 2016 12:09:15 -0600http://ask.sagemath.org/question/35559/how-do-change-a-string-of-letters-into-integers-using-sagecell/?answer=35561#post-id-35561