top of page

Python Programming Assignment | Sample Assignment



Part 1


Your program should start by asking the user to name a short story by path on the classicshorts.com (Links to an external site.) website. For example, if the user enters 'aos' then the program will access the website http://classicshorts.com/stories/aos.html (Links to an external site.). If the user enters an invalid short story (path, such as 'aps'--note the typo), the program will say "Short story not found" and quit. (Hint: try-except) If a story is found, state that the story was found and how many vocabulary terms there are.


Part 2


The program will store the vocabulary words in such a way that the user can optionally update the word's definition. Eliminate duplicates. By default, the definition should be an empty string (''). It will ask the user if he/she would like to update any definitions. If the user enters 'Y' (for yes), then program will ask for the term and definition. Afterwards, the program will ask the user if he/she would like to update additional definitions. If the user answers 'Y' again, then the program will repeat this step until the user enters 'N' (for no). Note, for words that already have definitions, the program MUST warn the user and state what the current definition is. For words not in the vocabulary list, the program will simply state that the word was not found and ask if the user would like to update additional definitions until 'N' is encountered.


Part 3


As a final step, the program will ask the user for a file name to save the vocabulary words. The text must be saved using format() such that there are enough spaces for the longest vocabulary word, followed by a space, a dash, and a space before the definition. The vocabulary words should be left aligned. See below for an example.


Here is an example of what the program should look like to the user, with red as the

user-input:




Here is an example of the corresponding output file: myvocab1.txt

Note that even though there are many instances of 'bazaar' in Araby, it is only counted

once in the unique vocabulary words list.


Here is another example of the program:



Here is an example of a short story with no vocabulary words:



Here is an example of a short story that could not be located:



Hints:


● All vocabulary words are associated with a dictionary.com hyperlink. Use the

dictionary.com hyperlink to extract the vocabulary work when you first go

through the original classicshorts.com

● (Links to an external site.)

● page.

● Not all key terms refer to dictionary.com. For example, "Hongkong" in Beyond

the Wall

● (Links to an external site.)

● links to a Wikipedia page. It does not need to be added to our vocabulary list.

● DO NOT TRY TO ACCESS ALL OF THE SHORT STORIES AS YOU

COULD GET LOCKED OUT OF THE WEBPAGE

● KEEP IT SIMPLE!


EXTENSION (5 points):

For the "extension" portion of this assignment, you will need to download and complete

this "Programming Extension Form": extension_template.docx

Think of 3 major changes (visible to the program user) that you can make the

current program more flexible or user-friendly. Here's is one possible example from

Individual Programming 1 (note this level of extension will not earn the full 5 points at

this level). For some improvements, it might help to look in the upcoming chapters.

In all, you should submit three files:

1. Original assignment exactly as prompted above (.py file)

2. Programming Extension Form (.docx file)

3. Modified .py file with changes as listed in the Extension Form


Some Solution Output and screenshot




Get solution of this project at affordable price. please send your query at contact@codersarts.com we'll share you price quote


bottom of page