1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
alisha [4.7K]
3 years ago
10

You decide to buy some stocks for a certain price and then sell them at anotherprice. Write a program that determines whether or

not the transaction wasprofitable. Here are the details:• Take three separate inputs: the number of shares, the purchaseprice of the stocks, and the sale price, in that order.• You purchase the number of stocks determined by the input.• When you purchase the stocks, you pay the price determined by the input.• You pay your stockbroker a commission of 3 percent on the amount paid forthe stocks.• Later, you sell the all of the stocks for the price determined by the input.• You pay your stockbroker another commission of 3 percent on the amountyou received for the stock.Your program should calculate your net gain or loss during this transaction andprint it in the following format:If your transaction was profitable (or if there was a net gain/loss of 0) print:"After the transaction, you made 300 dollars."(If, for example, you gained 300 dollars during the transaction.)If your transaction was not profitable, print:"After the transaction, you lost 300 dollars."(If, for example, you lost 300 dollars during the transaction.)Use string formatting.
Computers and Technology
1 answer:
Otrada [13]3 years ago
7 0

Answer:

no_of_shares = int(input("Enter the number of shares: "))

purchase_price = float(input("Enter the purchase price of the stock: "))

sale_price = float(input("Enter the sale price of the stock: "))

total_stock_price = purchase_price*no_of_shares

total_spend_on_buying = total_stock_price + (0.03*total_stock_price)

total_sale_price = sale_price*no_of_shares

commission_while_selling = total_sale_price*0.03

net_gain_or_loss = total_sale_price - (total_spend_on_buying + commission_while_selling)

if(net_gain_or_loss<0):

print("After the transaction, you lost {} dollars".format(abs(net_gain_or_loss)))

else:

print("After the transaction, you made {} dollars".format(abs(net_gain_or_loss)))

You might be interested in
What is meaning of reboot
TEA [102]
I believe to reboot is to reset. Its the act of resetting, or starting up a computer again.
4 0
3 years ago
Read 2 more answers
Sorting and filtering are two ways to blank data
madreJ [45]
It’s two ways to analyze data
6 0
3 years ago
Online education students need to be taught ______. Select 2 options.
Vladimir79 [104]

Answer:

-the reasons why they should be ethical


-how to communicate professionally

Explanation:

GOT IT RIGHT ON ODYSSEY

6 0
2 years ago
Open and close ____ immediately following the name of a procedure identify a Visual Basic statement as a procedure call statemen
Bezzdna [24]

Answer:  Parentheses

Explanation:

 The open and close parentheses basically identify the visual basic statement   in the procedure call statement.

The close procedure basically in the visual basic statement basically terminate the call of a program that performed the real processing. Open and close is also known as right and left parentheses.

The close statement is basically control the pre-defined programming statement in the particular close procedure.

 

4 0
3 years ago
The analog computer deals directly with
marta [7]

continuously variable aspects of physical phenomena such as a electrical, mechanical etc.

4 0
3 years ago
Read 2 more answers
Other questions:
  • All of the following are qualities of an aprenticeship except
    12·1 answer
  • Complete the sentence to identify disadvantages of top-down programming design. Choose all that apply. Top-down programming desi
    9·1 answer
  • Another html/css assignment, drop css code below, thank you
    15·1 answer
  • 50 POINTS &amp; A FOLLOW!
    11·2 answers
  • The database must be carefully planned to allow useful data manipulation and report generation.
    10·1 answer
  • Discuss the differences between a quantitative and qualitative risk analysis. Please write two paragraphs.
    8·1 answer
  • in java how do i Write a Java program that takes ten numbers as input to calculate and print the average of the numbers.
    11·1 answer
  • Hello 10 points if my Chromebook is on 26 percent how much time do I have left theoretically
    8·2 answers
  • I only put one answer and didn’t specify what it answered
    14·2 answers
  • 1. How is the pronoun their used in the second sentence?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!