Problem: I'm having issues calling classes in a program.
I created a program named example.py which has the following code:
class ExampleBase:
"""
This is the ExampleBase class
"""
def __init__(self, company_name="N/A", stock_dict={}):
"""
class constructor
"""
self.company_name = company_name
self.stock_dict = stock_dict
return
def __str__(self):
"""
Prints the company name string
"""
str = "The Company name is: %s" %\
(self.company_name
)
return str
def add_purchase(self, addtlSTK):
"""
Adds item to stock_dict
"""
self.stock_dict.update(addtlSTK)
return
I'm attempting to call ExampleBase in another program whose code is:
import example
if __name__ == "__main__":
a = {"10-01-2014":(10, 11.25), "10-02-2014":(11, 12.25), "10-03-2014":(12, 13.25)}
b = example.ExampleBase("Bern", a)