-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLab03_PolishNotationStack.html
46 lines (36 loc) · 2 KB
/
Lab03_PolishNotationStack.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<html>
<head>
<title>UW COSC 2030 Spring 2019: Lab 03</title>
</head>
<body lang=EN-US>
<p>UWyo COSC 2030 Spring 2019</p>
<h1>Lab 03: Polish Notation Stack</h1>
<p>Due March 4th at 7:00 p.m.</p>
<h2>Background</h2>
<p>The stack ADT is useful for starting and suspending tasks while subordinate tasks are completed.</p>
<p>By the end of this lab, you will have a code repository in your files that contains the following deliverables:</p>
<ul>
<li><kbd>README.md</kbd></li>
<li><kbd><em>your-name</em>_HelpSheet.txt</kbd></li>
<li><kbd>PrefixPolish.py</kbd></li>
</ul>
<h2>Preparation</h2>
<ol>
<li>Download the following files, either from GitHub lab03-stack or from the Lab Materials on WyoCourses, for today's lab:<br/>
<kbd>PostfixPolish.py</kbd>
</li>
<li>Study the implementation of the stack via the <em>List</em> data type in Python. </li>
</ol>
<h2>Tasks</h2>
<ol>
<li>Examine, compile, and execute the code.</li>
<li>This program inserts at position 0. A better implementation uses the back end of the stack as the "top", for push and pop purposes, using the list operator <kbd>append</kbd>. See the Python Tutorial for that model, and change the code to do that.
<li>The standard Polish notation developed by the eminent mathematician Jan Łukasiewicz puts the operator first, followed by the operands. Now change your Python program to that prefix model—save it as <kbd>PrefixPolish.py</kb> to submit‐and evaluate the test expressions that way.</li>
<li>In the README file:
Write the quadratic equation in both Polish Notation (prefix) and Reverse Polish Notation (postfix).</li>
<li>Add to your Help Sheet: List the Python modules that you have imported in your Python experience, and what they contain. And answer this question:
What is the class of the ops variable? (Review Ch. 5 of the Tutorial.) And what are the other general-purpose built-in <em>container</em> data structures in Python?</li>
</ol>
<p>End of Lab 03</p>
</body>
</html>