lab4 Intro to Python

timer Asked: Nov 15th, 2016

Question description


  • Doing more with lists/dictionaries and introducing files.
  • NOTE: This lab is actually 2 separate programs.


  • This will extends the previous lab to allow the user to display the resulting story with several potential "dynamic" modifications to their input.


  1. First, Create a file called story_template.txt which contains the strings (and placeholders) for you story template (as created in the previous lab).
  2. Program 1: (
    • Create a Python program which reads in a set of words from the user (as before), but this time writes them to a called: story_dictionary.txt
    • NOTE: This is essentially the exact same thing as in the previous lab, but only writing the data out to a file.
  3. Program 2: (
    • Your program should read a "story template" and "word dictionary" from input files and write the output to the screen.
    • The filenames and "input conversion type" (see below) should be read from the "command line" when the program is launched.
    • For example: 1 story_template.txt input_words.txt

    • If the user launched the program without the correct parameters, a usage message should be shown (such as):
      CONVERSION: 1 for UPPER CASE, 2 for LOWERCASE, etc...

Conversion Types (of just your input words, not the whole story):

    1. All UPPER CASE
    2. All lower case
    3. All Capitalized Case
    4. As entered (i.e., no changes)


  1. For more information on strings:
  2. For more information on files:

Example input files:

Story file:

I have a dog named {PETNAME} who barks a lot
and loves to {ACTIVITY} every day.

Words dictionary:


check the frist and see if its match the same lab or not

Tutor Answer

(Top Tutor) Studypool Tutor
School: Purdue University
Studypool has helped 1,244,100 students
flag Report DMCA
Similar Questions
Hot Questions
Related Tags
Study Guides

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors