• Welcome to ForumKorner!
    Join today and become a part of the community.

Python encryption program

Glubz

User is banned.
Reputation
0
It's a little bit disorganised, but it's my first attempt. 

Code:
# Beginning code
def encrypt():
    print "This is a small school project for encrypting text via Python."




# Input questions
text = raw_input("Enter the text you would like to encrypt: ")
key = input("Input value key:  ")




# Accumulator
lstmsg = ""
for j in text:
    lstmsg = lstmsg + chr(ord(j) +key)




# Output for the encrypted message
print "[" + lstmsg + "]"
What do you guys think I should do to improve?
 

velox

Onyx user!
Reputation
0
Maintain raw_input instead of input. The latter runs an eval on the returned string. How about inverting what you've written to decrypt?
 
Top