Getting Started
•
ps4-psuedo.txt: For problems 2a and 4a.
•
ps4.py: the skeleton you’ll fill in
•
words.txt: a list of English words
•
fable.txt: an encoded fable
Run the code without making any modifications to it, in order to ensure that everything is set up
correctly. The code that we have given you loads a list of words from a file. If everything is
okay, after a small delay, you should see the following printed out:
Loading word list from file...
55902 words loaded.
If you see an IOError instead (e.g., No such file or directory), you should change the value of the
WORDLIST_FILENAME constant (defined near the top of the file) to the complete pathname
for the file words.txt (this will vary based on where you saved the file).
The file, ps4.py, has a few functions already implemented that you can use while writing up your
solution. You can ignore the code between the following comments, though you should read and
understand everything else:
# -----------------------------------
# Helper code
# (you don't need to understand this helper code)
. . .
# (end of helper code)
# -----------------------------------
Pseudocode
Pseudocode is writing out the algorithm/solution in a form that is like code, but not quite code.
Pseudocode is language independent, uses plain English (or your native language), and is readily
understandable.
Algorithm related articles
in wikipedia often use pseudocode to explain the
algorithm.
Think of writing pseudocode like you would explain it to another person – it doesn’t generally
have to conform to any particular syntax as long as what’s happening is clear to the grader.
Pseudocode
is a compact and informal high-level description of a
computer programming
algorithm
that uses the structural conventions of a
programming language
, but is intended for
human reading rather than machine reading. Pseudocode typically omits details that are not
essential for human understanding of the algorithm, such as
variable declarations
, system-
specific code and
subroutines
. The purpose of using pseudocode is that it is easier for humans to
understand than conventional programming language code, and that it is a compact and
environment-independent description of the key principles of an algorithm. No standard for
pseudocode syntax exists, as a program in pseudocode is not an executable program. –
wikipedia
In order to help you solve these problems correctly, we are requiring that you submit
Dostları ilə paylaş: |