954,525 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Homework Help (Vigenere Cipher)

Hi, I'm brand new to Python and am completely clueless in this assignment. This is the 3rd assignment, but the first without hints on how to import, etc..

The objective of this assignment was to decode a file we are supposed to use the python hw.py < code.txt command with. This confused me right from the start, I understand that it uses the file as the input, but I dont understand how to do that code sided. We are also supposed to be shifting using letter frequencies, which are in percentages, also have not yet been discussed in class. Any help would be greatly appreciated. I have taken a look at the other vigenere ciphers, but they are way to complicated to my understanding.

Thanks a bunch!

persianprez
Junior Poster in Training
97 posts since Oct 2006
Reputation Points: 10
Solved Threads: 1
 

In order to read the contents of code.txt , you'll need to read the stdin pipe . To access it, use the sys.stdin handle, which you can read from just like an open file handle. You'll need to use the sys module, obviously.

The rest is just coding the cypher.

HTH

jlm699
Veteran Poster
1,112 posts since Jul 2008
Reputation Points: 355
Solved Threads: 292
 

In order to read the contents of code.txt , you'll need to read the stdin pipe . To access it, use the sys.stdin handle, which you can read from just like an open file handle. You'll need to use the sys module, obviously.

The rest is just coding the cypher.

HTH

alternatively you can just grab the file location as if it was an argument like so:

import sys
f=open(sys.arg[2],'r')


That should do it as well.

ov3rcl0ck
Junior Poster
113 posts since Sep 2009
Reputation Points: 35
Solved Threads: 22
 
import sys
f=sys.arg[2]


my bad

ov3rcl0ck
Junior Poster
113 posts since Sep 2009
Reputation Points: 35
Solved Threads: 22
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: