Respuesta :
Shares_Purchased = 0.0
Amt_PaidPerShare = 0.0
Commission_Percentage = 0.0
Paid_WithoutCommission = 0.0
Commission_Paid = 0.0
Total_Paid = 0.0
Shares_Sold = 0.0
Amt_SoldPerShare = 0.0
Sale_Amount = 0.0
Earned_WithoutCommission = 0.0
Commission_PaidSale = 0.0
Total_Earned = 0.0
ProfitNoProfit = 0.0
#calculation starts from here
Shares_Purchased = float(input("How many shares did you purchase? \n "
"enter in 0.0 form: "))
Amt_PaidPerShare = float(input("How much did you pay per share? \n"
"enter in 0.0 form: "))
Commission_Percentage = float(input("What percentage is your stockbroker \n"
"Charging per transaction? enter in 0.00 form: "))
Paid_WithoutCommission = Amt_PaidPerShare * Shares_Purchased
Commission_Paid = Paid_WithoutCommission * Commission_Percentage
TotalPaid = Commission_Paid + Paid_WithoutCommission
Shares_Sold = float(input("How many shares did you sell? \n "
"enter in 0.0 form: "))
Amt_SoldPerShare = float(input("How much did you sell each share for? \n"
"enter in 0.0 form: "))
Earned_WithoutCommission = Amt_SoldPerShare * Shares_Sold
Commission_PaidSale = Earned_WithoutCommission * Commission_Percentage
Total_Earned = Earned_WithoutCommission - Commission_PaidSale
ProfitNoProfit = Total_Earned - Total_Paid
#printing the output
print ("You paid the following for the shares:")
print (Paid_WithoutCommission)
print ("You paid the following in commissions to your stockbroker for the purchase:")
print (Commission_Paid)
print ("In total, you paid:")
print (Total_Paid)
print ("You sold your shares for the amount of:")
print (Earned_WithoutCommission)
print ("You paid the following in commissions to your stockbroker for the sale:")
print (Commission_PaidSale)
print ("In total, your revenue is: ")
print (Total_Earned)
if ProfitNoProfit > 0:
print ("You have earned a profit of: %s." % ProfitNoProfit)
elif ProfitNoProfit == 0:
print ("You have broken even")
else: print ("You have lost this amount: %s." % ProfitNoProfit)