On 15 December 2011 23:37, Calle <calle_pyt...@live.se> wrote:
I was wondering, how do you use Python to decipher codes? It feels like it should be pretty simple, but I haven't found any tutorials about it yet.
<End>

What kind of codes? Or do you mean ciphers? Generally speaking, a code
represent letters or numbers in transmitting a message. In other
words, a code deals with phrases and sentences or whole words. Example
"steal the cabbage at dawn" could mean "kill the king on wednesday".

A cipher deals with letters. It is a message written in letters in a
predetermined code. This means that a cipher is a system of
communication that uses letters instead of phrases. Examples being the
standard Caesar cipher where "APPLE" might be written "BQQMB" (ie,
shifted one letter to the right).

--
best regards,
Robert S.
<End>

>Sorry, I meant ciphers. How would a basic script for solving
move-one-step-to-the-right ciphers look like?
<End>

Weeeell... There are different ways to solve that, but show us what
you've come up with so far and we might be able to point you in the
right direction. You won't learn anything by getting the answer posted
and just copy-paste it for whatever (nefarious) use you need it;
you'll learn a lot more if you work toward the solution yourself. I'll
just point you in the direction of ASCII values for now.

--
best regards,
Robert S.
<End>

Well, I don't really know where to begin. I tried looking at other peoples
code and write something based on that, but it ended up being too similair
to the original code... I could show you what I came up with using
pseudo-code.

Get the cipher from user.
Use ord() to convert into numbers.
Add number to a new string while at the same time making it into a letter
using chr().
Repeat 25 times and print the results.

Am I on the right track with this or should I re-think?

//
Calle
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to