Python Programing

****Assignment #4 Makeup – Instead of in-fix notation for our maybe-probably logic language, you should implement the parse, evaluate, and print functions to work with pre-fix notation. The input strings will now be of the form, s = ‘ AND T M_0.5 ‘, and will not need parentheses. 

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

General structure of your make-up assignment (regardless of which one) should be as follows:

import unittest

class YourClass:
    “””
    YOUR CLASS DOCUMENTATAION
    “””
    def __init__(self, size):
        “”” INSERT COMMMENTS (IN YOUR OWN WORDS) “””
        pass
    # ADD YOUR OTHER METHODS HERE…

def YourFunctionA:
    “”” DOCUMENTATION FOR THIS FUNCTION “””
    pass
    # ADD YOUR OTHER FUNCTIONS HERE (IF NEEDED)…

Save Time On Research and Writing
Hire a Pro to Write You a 100% Plagiarism-Free Paper.
Get My Paper

class TestYourClassOrFuctions(unittest.TestCase):
    def testMethodA(self):
        “”” INSERT DESCRIPTION OF WHAT THIS TEST IS CHECKING.. “””
        pass
    # ADD MORE TESTS TO CHECK YOUR OTHER CLASSES/METHODS/FUNTIONS WORK

# main() – run any example/demo you want to when running as standalone program
def main():
    pass
# unittest_main() – run unittest’s main, which will run TestHashTable’s methods
def unittest_main():
    unittest.main()
# evaluates to true if run as standalone program
if __name__ == ‘__main__’:
    main()
    unittest_main()

Previous

Next

class Stack:
“”” a custom stack implementation using a Python list “””
def __init__(self):
“”” Instantiate the single field (a list) in a Stack object “””
self.items = []
def isEmpty(self):
“”” Return a bool based on whether stack contains 1 or more (-> True) or 0 items (-> False) “””
return self.items == []
def push(self, item):
self.items.append(item)
def pop(self):
return self.items.pop()
def peek(self):
return self.items[len(self.items)-1]
def size(self):
return len(self.items)

class BinaryTree:
def __init__(self, rootObj):
self.key = rootObj
self.leftChild = None
self.rightChild = None
def insertLeft(self, newNode):
if self.leftChild == None:
self.leftChild = BinaryTree(newNode)
else:
temp = BinaryTree(newNode)
temp.leftChild = self.leftChild
self.leftChild = temp
def insertRight(self, newNode):
if self.rightChild == None:
self.rightChild = BinaryTree(newNode)
else:
tempTree = BinaryTree(newNode)
tempTree.rightChild = self.rightChild
self.rightChild = tempTree
def getRightChild(self):
return self.rightChild
def getLeftChild(self):
return self.leftChild
def setRootVal(self, obj):
self.key = obj
def getRootVal(self):
return self.key
def printTree(self):
“”” current -> left -> right (along with None’s)”””
print(self.key)
if self.leftChild == None:
print(self.leftChild)
else:
self.leftChild.printTree()
if self.rightChild == None:
print(self.rightChild)
else:
self.rightChild.printTree()
def preOrder(self):
“”” current -> left -> right “””
if self.key:
print(self.key)
if self.leftChild:
self.leftChild.preOrder()
if self.rightChild:
self.rightChild.preOrder()
def postOrder(self):
“”” left -> right -> current “””
if self.leftChild:
self.leftChild.postOrder()
if self.rightChild:
self.rightChild.postOrder()
if self.key:
print(self.key)
def inOrder(self):
“”” left -> current -> right “””
if self.leftChild:
self.leftChild.inOrder()
if self.key:
print(self.key)
if self.rightChild:
self.rightChild.inOrder()

from binarytree import BinaryTree
from stack import Stack
import unittest

def buildMPLogicParseTree(s):
“”” ADD ANY DOCUMENTATION HERE, AND IMPLEMENTATION BELOW “””
pass
def evaluateMPLogicParseTree(t):
“”” ADD ANY DOCUMENTATION HERE, AND IMPLEMENTATION BELOW “””
pass
def printMPLogicExpression(t):
“”” ADD ANY DOCUMENTATION HERE, AND IMPLEMENTATION BELOW “””
pass

class TestParseTree(unittest.TestCase):
“”” ADD METHODS TO TEST PARSE/EVAL/PRINT FUNCTIONS “””
pass
def unittest_main():
unittest.main()

def main():
pass
# only executed if run as a standalone program
if __name__ == ‘__main__’:
main()
unittest_main()

Calculate your order
Pages (275 words)
Standard price: $0.00
Client Reviews
4.9
Sitejabber
4.6
Trustpilot
4.8
Our Guarantees
100% Confidentiality
Information about customers is confidential and never disclosed to third parties.
Original Writing
We complete all papers from scratch. You can get a plagiarism report.
Timely Delivery
No missed deadlines – 97% of assignments are completed in time.
Money Back
If you're confident that a writer didn't follow your order details, ask for a refund.

Calculate the price of your order

You will get a personal manager and a discount.
We'll send you the first draft for approval by at
Total price:
$0.00
Power up Your Academic Success with the
Team of Professionals. We’ve Got Your Back.
Power up Your Study Success with Experts We’ve Got Your Back.

Order your essay today and save 30% with the discount code ESSAYHELP