[Tutor] My Program stopped working, can anyone help

Padmanaban Ganesan padhu.47 at gmail.com
Wed Apr 1 12:24:03 CEST 2009


Hi Jared,

This is program is working fine for me.
Please check the indentation is proper in it.


def main():
 print "This program will encode your messages using a Caesar Cipher"
print
key = input("Enter the key: ")
message = raw_input("Enter the message: ")
codedMessage = ""
for ch in message:
 codedMessage = codedMessage + chr(ord(ch) + key)
print "The coded message is:", codedMessage

main()

Sample Execution:
----------------------------

Enter the key: 123
Enter the message: Hi Paddy
The coded message is: Ãä›ËÜßßô
This program will encode your messages using a Caesar Cipher


-- 
Ta,
Paddy
"The Secret to creativity is knowing how to hide your sources "


2009/4/1 Jared White <dukelx2005 at gmail.com>

> I am trying to produce A Caesar cipher is a simple substitution cipher ,
> that would code For example, if the key value is 2, the word “Sourpuss”
> would be encoded as “Uqwtrwuu
>
> Here is my code: ( but i keep getting a ERROR) It works for me Last week
> but for some reason it isnt work for me right now. ANY REASON WHY PLEASE
> HELP [image: :(]
>
> # alphabet.py
> # Simple string processing program to generate an encryp text
>
>
> def main():
> print "This program will encode your messages using a Caesar Cipher"
> print
> key = input("Enter the key: ")
> message = raw_input("Enter the message: ")
> codedMessage = ""
> for ch in message:
> codedMessage = codedMessage + chr(ord(ch) + key)
> print "The coded message is:", codedMessage
>
>
> main()
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20090401/d7a6a130/attachment.htm>


More information about the Tutor mailing list