Need main to call functions in order, properly
<pre><code>def load():    
    global name
    global count
    global shares
    global pp
    global sp
    global commission
    name=input("Enter stock name OR -999 to Quit: ")
    count =0
    while name != '-999':
        count=count+1
        shares=int(input("Enter number of shares: "))
        pp=float(input("Enter purchase price: "))
        sp=float(input("Enter selling price: "))
        commission=float(input("Enter commission: "))
        name=input("\nEnter stock name OR -999 to Quit: ")

totalpr=0
def calc():
    global amount_paid
    global amount_sold
    global profit_loss
    global commission_paid_sale
    global commission_paid_purchase
    global totalpr
    amount_paid=shares*pp
    commission_paid_purchase=amount_paid*commission
    amount_sold=shares*sp
    commission_paid_sale=amount_sold*commission
    profit_loss=(amount_sold - commission_paid_sale) -(amount_paid + commission_paid_purchase)
    totalpr=totalpr+profit_loss

def display():
    print("\nStock Name:", name)
    print("Amount paid for the stock:       $",      format(amount_paid, '10,.2f'))
    print("Commission paid on the purchase: $", format(commission_paid_purchase, '10,.2f'))
    print("Amount the stock sold for:       $", format(amount_sold, '10,.2f'))
    print("Commission paid on the sale:     $", format(commission_paid_sale, '10,.2f'))
    print("Profit (or loss if negative):    $", format(profit_loss, '10,.2f'))

def main():
    load()
    calc()
    display()

main()

print("\nTotal Profit is $", format(totalpr, '10,.2f'))
</code></pre>

<p>I <em>need</em> the <code>main():</code> to call <code>load()</code>,<code>calc()</code> and <code>display()</code> in that order. However, the program stops after load. The output will merely loop the load without calc or print. </p>

<p>I have been instructed <strong>specifically</strong> to NOT place <code>calc()</code> and <code>display()</code> in the while loop block, tempting as that may be. Also note, that solves the problem but that is not the solution I am specifically looking for. </p>

<p>What do I need to do to make this program work properly? </p>

<p>OUTPUT SHOULD LOOK LIKE THIS: </p>

<pre><code>Enter stock name OR -999 to Quit: APPLE
Enter number of shares: 10000
Enter purchase price: 400
Enter selling price: 800
Enter commission: 0.04

Stock Name: APPLE
Amount paid for the stock:       $ 4,000,000.00
Commission paid on the purchase: $ 160,000.00
Amount the stock sold for:       $ 8,000,000.00
Commission paid on the sale:     $ 320,000.00
Profit (or loss if negative):    $ 3,520,000.00

Enter stock name OR -999 to Quit: FACEBOOK
Enter number of shares: 10000
Enter purchase price: 5
Enter selling price: 500
Enter commission: 0.04

Stock Name: FACEBOOK
Amount paid for the stock:       $  50,000.00
Commission paid on the purchase: $   2,000.00
Amount the stock sold for:       $ 5,000,000.00
Commission paid on the sale:     $ 200,000.00
Profit (or loss if negative):    $ 4,748,000.00

Enter stock name OR -999 to Quit: -999
Total Profit is $ 14,260,000.00
</code></pre>

<p>HERE IS THE OUTPUT ERROR I AM GETTING: </p>

<pre><code>====== RESTART: C:\Users\Elsa\Desktop\Homework 3, Problem 1.py ======
Enter stock name OR -999 to Quit: YAHOO!
Enter number of shares: 10000
Enter purchase price: 10
Enter selling price: 100
Enter commission: 0.04

Enter stock name OR -999 to Quit: GOOGLE
Enter number of shares: 10000
Enter purchase price: 15
Enter selling price: 150
Enter commission: 0.03

Enter stock name OR -999 to Quit: -999

Stock Name: -999
Amount paid for the stock:       $ 150,000.00
Commission paid on the purchase: $   4,500.00
Amount the stock sold for:       $ 1,500,000.00
Commission paid on the sale:     $  45,000.00
Profit (or loss if negative):    $ 1,300,500.00

Total Profit is $ 1,300,500.00
&gt;&gt;&gt; 
</code></pre>

<p>Based on your comment</p>

<pre><code>take the calc() and display() inside the loop and move them directly into def main():
</code></pre>

<p>this is consistent with your expected output:</p>

<pre><code>def main():
    name=input("Enter stock name OR -999 to Quit: ")
    count, totalpr = 0, 0
    while name != '-999':
        count=count+1
        shares=int(input("Enter number of shares: "))
        pp=float(input("Enter purchase price: "))
        sp=float(input("Enter selling price: "))
        commission=float(input("Enter commission: "))
        # calculation
        amount_paid=shares*pp
        commission_paid_purchase=amount_paid*commission
        amount_sold=shares*sp
        commission_paid_sale=amount_sold*commission
        profit_loss=(amount_sold - commission_paid_sale) -(amount_paid + commission_paid_purchase)
        totalpr=totalpr+profit_loss
        # printing
        print("\nStock Name:", name)
        print("Amount paid for the stock:       $",      format(amount_paid, '10,.2f'))
        print("Commission paid on the purchase: $", format(commission_paid_purchase, '10,.2f'))
        print("Amount the stock sold for:       $", format(amount_sold, '10,.2f'))
        print("Commission paid on the sale:     $", format(commission_paid_sale, '10,.2f'))
        print("Profit (or loss if negative):    $", format(profit_loss, '10,.2f'))
        # next loop
        name=input("\nEnter stock name OR -999 to Quit: ")

print("\nTotal Profit is $", format(totalpr, '10,.2f'))
</code></pre>

<p>It seems like an exercise in refactoring - moving function together into a single function.</p>

python function python-3.x