Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #40885 > unrolled thread

crypto program in python.

Started bykhudo.anastasia@gmail.com
First post2013-03-08 11:01 -0800
Last post2013-03-08 14:40 -0500
Articles 6 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  crypto program in python. khudo.anastasia@gmail.com - 2013-03-08 11:01 -0800
    Re: crypto program in python. Neil Cerutti <neilc@norwich.edu> - 2013-03-08 19:07 +0000
      Re: crypto program in python. khudo.anastasia@gmail.com - 2013-03-08 11:12 -0800
        Re: crypto program in python. Neil Cerutti <neilc@norwich.edu> - 2013-03-08 19:32 +0000
          Re: crypto program in python. khudo.anastasia@gmail.com - 2013-03-08 11:35 -0800
          Re: crypto program in python. Joel Goldstick <joel.goldstick@gmail.com> - 2013-03-08 14:40 -0500

#40885 — crypto program in python.

Fromkhudo.anastasia@gmail.com
Date2013-03-08 11:01 -0800
Subjectcrypto program in python.
Message-ID<f55c2474-7312-4366-bde8-d2bb45b22837@googlegroups.com>
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 am confused about menu and the str function if you can help me with this code it will be awesome thank you!!!

[toc] | [next] | [standalone]


#40886

FromNeil Cerutti <neilc@norwich.edu>
Date2013-03-08 19:07 +0000
Message-ID<apur8aFl9e5U1@mid.individual.net>
In reply to#40885
On 2013-03-08, khudo.anastasia@gmail.com <khudo.anastasia@gmail.com> wrote:
> 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 am confused about menu and the str function if you can help
> me with this code it will be awesome thank you!!!

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.

-- 
Neil Cerutti

[toc] | [prev] | [next] | [standalone]


#40887

Fromkhudo.anastasia@gmail.com
Date2013-03-08 11:12 -0800
Message-ID<79311e2f-37a4-4050-b9fa-d0084c092c5f@googlegroups.com>
In reply to#40886
On Friday, March 8, 2013 2:07:55 PM UTC-5, Neil Cerutti wrote:
> On 2013-03-08, khudo.anastasia@gmail.com <khudo.anastasia@gmail.com> wrote:
> 
> > 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 am confused about menu and the str function if you can help
> 
> > me with this code it will be awesome thank you!!!
> 
> 
> 
> 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.
> 
> 
> 
> -- 
> 
> 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

[toc] | [prev] | [next] | [standalone]


#40891

FromNeil Cerutti <neilc@norwich.edu>
Date2013-03-08 19:32 +0000
Message-ID<apusm7Flmc9U1@mid.individual.net>
In reply to#40887
On 2013-03-08, khudo.anastasia@gmail.com
<khudo.anastasia@gmail.com> wrote:
>> 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 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?

-- 
Neil Cerutti

[toc] | [prev] | [next] | [standalone]


#40892

Fromkhudo.anastasia@gmail.com
Date2013-03-08 11:35 -0800
Message-ID<c3adc96d-5451-496b-b2d6-57e53244d62a@googlegroups.com>
In reply to#40891
On Friday, March 8, 2013 2:32:24 PM UTC-5, Neil Cerutti wrote:
> On 2013-03-08, khudo.anastasia@gmail.com
> 
> <khudo.anastasia@gmail.com> wrote:
> 
> >> 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 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?
> 
> 
> 
> -- 
> 
> Neil Cerutti

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

[toc] | [prev] | [next] | [standalone]


#40893

FromJoel Goldstick <joel.goldstick@gmail.com>
Date2013-03-08 14:40 -0500
Message-ID<mailman.3094.1362771640.2939.python-list@python.org>
In reply to#40891

[Multipart message — attachments visible in raw view] — view raw

On Fri, Mar 8, 2013 at 2:32 PM, Neil Cerutti <neilc@norwich.edu> wrote:

> On 2013-03-08, khudo.anastasia@gmail.com
> <khudo.anastasia@gmail.com> wrote:
> >> 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 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?
>
> --
> Neil Cerutti
> --
> http://mail.python.org/mailman/listinfo/python-list
>

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

-- 
Joel Goldstick
http://joelgoldstick.com

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web