crypto program in python.

  • Thread starter khudo.anastasia
  • Start date
K

khudo.anastasia

Hi every every body,
Today I have to submit my assignment for Computer Science, And I am absolutely stuck in writing the code. Please help me in soon possible.

The main idea of the program is encode and decode the text.
that wot the instructor gave us so far.

Sample Run

Here's a sample run of the basic program in action.

SECRET DECODER MENU

0) Quit
1) Encode
2) Decode

What do you want to do? 1
text to be encoded: python rocks
AQULEWKEMNJ


SECRET DECODER MENU

0) Quit
1) Encode
2) Decode

What do you want to do? 2
code to be decyphered: AQULEWKEMNJ
PYTHONROCKS


SECRET DECODER MENU

0) Quit
1) Encode
2) Decode

What do you want to do? 0
Thanks for doing secret spy stuff with me.
-----------------------------------
and


alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key = "XPMGTDHLYONZBWEARKJUFSCIQV"

def main():
keepGoing = True
while keepGoing:
response = menu()
if response == "1":
plain = raw_input("text to be encoded: ")
print encode(plain)
elif response == "2":
coded = raw_input("code to be decyphered: ")
print decode(coded)
elif response == "0":
print "Thanks for doing secret spy stuff with me."
keepGoing = False
else:
print "I don't know what you want to do..."
 
N

Neil Cerutti

Hi every every body,
Today I have to submit my assignment for Computer Science, And
I am absolutely stuck in writing the code. Please help me in
soon possible.

The main idea of the program is encode and decode the text.
that wot the instructor gave us so far.

Sample Run

Here's a sample run of the basic program in action.

SECRET DECODER MENU

0) Quit
1) Encode
2) Decode

What do you want to do? 1
text to be encoded: python rocks
AQULEWKEMNJ


SECRET DECODER MENU

0) Quit
1) Encode
2) Decode

What do you want to do? 2
code to be decyphered: AQULEWKEMNJ
PYTHONROCKS


SECRET DECODER MENU

0) Quit
1) Encode
2) Decode

What do you want to do? 0
Thanks for doing secret spy stuff with me.
-----------------------------------
and


alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key = "XPMGTDHLYONZBWEARKJUFSCIQV"

def main():
keepGoing = True
while keepGoing:
response = menu()
if response == "1":
plain = raw_input("text to be encoded: ")
print encode(plain)
elif response == "2":
coded = raw_input("code to be decyphered: ")
print decode(coded)
elif response == "0":
print "Thanks for doing secret spy stuff with me."
keepGoing = False
else:
print "I don't know what you want to do..."

I believe your instructor intends you to start with the skeleton
of the program provided above. Complete it by writing the missing
functions: menu, decode, and encode.
 
K

khudo.anastasia

I believe your instructor intends you to start with the skeleton

of the program provided above. Complete it by writing the missing

functions: menu, decode, and encode.

that is where I confused, I am not sure how to do it, I started but nothing works. And the tutorials at the internet not helpful. If you could write me the code for the decode function, that would be awesome, and other i can do by myself.

thanks
 
N

Neil Cerutti

that is where I confused, I am not sure how to do it, I started
but nothing works. And the tutorials at the internet not
helpful. If you could write me the code for the decode
function, that would be awesome, and other i can do by myself.

Thanks for being honest. But I cannot agree to write any code for
you.

Can you post an example of something you tried that didn't work?
 
K

khudo.anastasia

Thanks for being honest. But I cannot agree to write any code for

you.



Can you post an example of something you tried that didn't work?

print (' SECRET DECODER MENU')
print (' 1) Encode')
print (' 2) Decode')
print (' 3) Quit')

response = raw_input (" What do you want to do? ")
print response

import alpha

def menu():
while response is "1" or "2" or "3":
if response not in ('1', '2', '3'):
print ("I don't know what you want to do...")
continue
 
J

Joel Goldstick

Thanks for being honest. But I cannot agree to write any code for
you.

Can you post an example of something you tried that didn't work?

First, think about how to do this without writing code.

alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
key = "XPMGTDHLYONZBWEARKJUFSCIQV"

The example shows "python rocks" being turned into
AQULEWKEMNJ

Do you see from the two strings how that works? If you can see that, write
a description of how you encode a message. Bring that back with some code
that does the same and you will get help
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top