Skip to content

Instantly share code, notes, and snippets.

@123Phil
Created November 21, 2013 05:33
Show Gist options
  • Save 123Phil/7576549 to your computer and use it in GitHub Desktop.
Save 123Phil/7576549 to your computer and use it in GitHub Desktop.
those functions weren't necessary... this is probably all you want
stock = raw_input("What is the stock name? ")
buy_price = raw_input("What did you buy the stock at? ")
current_price = raw_input("What is the stock's current price? ")
stock_number = raw_input("How many stocks did you buy? ")
tax = raw_input("Did you buy this stock over a year ago? ")
change = float(current_price) - float(buy_price)
profit_before_tax = float(change) * float(stock_number)
if tax.upper() == 'NO' or tax.upper() == 'N':
tax_charged = float(profit_before_tax) * .35
profit = float(profit_before_tax) - float(tax_charged)
else:
profit = float(profit_before_tax)
percent_change = float(change) / float(buy_price)
percent_change_percentage = float(percent_change) * 100
print 'Profit: ' + profit
print 'Percent change: ' + str(percent_change_percentage) + '%'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment