Python Workshops for Beginners/Saturday September 27th homework: Difference between revisions

Content added Content deleted
Line 24: Line 24:
To get started, import the two modules which provide the character list and text of the play:
To get started, import the two modules which provide the character list and text of the play:
<pre>
<pre>
>>> import summerChar
>>> import characters from summerChar
>>> import summerNight
>>> import lines from summerNight
</pre>
</pre>


Character names are stored in the form <NAME>, which is how their parts are represented in the script.
To access the list of characters, set the following variable:
<pre>
>>> characters = summerChar.lines
</pre>


Each line of the play is an entry in the list.
Note: character names are stored in the form <NAME>, which is how their parts are represented in the script.

To access the text of the play as a list (each line is an entry in the list):
<pre>
>>> lines = summerNight.lines
</pre>