While loop not printing inputs, quitting doesn't break out of while loop
<pre><code>#Initialization
count=0
name=0

#Input
while name!='-999':
    count=count+1
    name=input("Enter stock name OR -999 to Quit:")
    shares=int(input("Enter number of shares:"))
    pp=float(input("Enter purchase price:"))
    sp=float(input("Enter selling price:"))
    commission=float(input("Enter commission:"))


#Calculations
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)

#Output
print("Stock 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'))

===============================OUTPUT===================================================
Enter stock name OR -999 to Quit:Google
Enter number of shares:10000
Enter purchase price:39.99
Enter selling price:35.99
Enter commission:0.04
Enter stock name OR -999 to Quit:Amazon
Enter number of shares:10000
Enter purchase price:15.99
Enter selling price:33.99
Enter commission:0.04
Enter stock name OR -999 to Quit:-999
Enter number of shares:10000
Enter purchase price:14.99
Enter selling price:49.99
Enter commission:0.04
Stock Name: -999
Amount paid for the stock:       $ 149,900.00
Commission paid on the purchase: $   5,996.00
Amount the stock sold for:       $ 499,900.00
Commission paid on the sale:     $  19,996.00
Profit (or loss if negative):    $ 324,008.00
</code></pre>

<p>As you can see I'm inputting stocks for Google and Amazon, but they're not being printed when I run the "-999" to break out of the while loop. Instead, it thinks that "-999" is a Stock name and quits when you enter fake numbers for it and prints those instead. I can't figure out what I'm doing wrong. </p>

<p>You are checking the value of <code>name</code> <em>before</em> you enter <code>-999</code>. Change your loop to this:</p>

<pre><code>while True:
    x = input("Enter stock name OR -999 to Quit:")
    if x == '-999':
        break
    count = count+1
    name = x
    shares = int(input("Enter number of shares:"))
    pp = float(input("Enter purchase price:"))
    sp = float(input("Enter selling price:"))
    commission = float(input("Enter commission:"))
</code></pre>

<p>That said, your script is only going to process the information for the <em>last</em> stock you enter; each iteration of the loop overwrites the previous value of <code>name</code>, <code>shares</code>, <code>pp</code>, <code>sp</code>, and <code>commission</code>. You want to either move the calculations inside the loop as well, or save <em>all</em> the data entered in a list or a dictionary so you can access it later.</p>

python python-3.x while-loop