lab4 Intro to Python

Anonymous
timer Asked: Nov 15th, 2016

Question description

Objectives

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

Overview

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

Instructions

  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: (readinput.py)
    • 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: (generatestory.py)
    • 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:
      LAB4.py 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):
      USAGE: LAB4.py <CONVERSION> <STORY_TEMPLATE> <INPUT_DICTIONARY>
      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)

NOTES:

  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:

PETNAME=Spot
ACTIVITY=Bark


check the LAB4.zip 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