Ask Your Question

how do change a string of letters into integers using sagecell?

asked 2016-11-13 11:22:55 -0500

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.

edit retag flag offensive close merge delete

1 answer

Sort by ยป oldest newest most voted

answered 2016-11-13 12:09:15 -0500

ndomes gravatar image

An 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])

M = matrix(2,5,L_int)
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

1 follower


Asked: 2016-11-13 11:22:55 -0500

Seen: 23 times

Last updated: Nov 13 '16