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
30 POINTS! PLEASE ANSWER QUICK!!!
SpyIntel [72]

Answer:

your doctype comes first.

Explanation:

The first thing you should make sure to have in any HTML document you create is a "document type definition (DTD)" declaration.

it defines what elements and attributes are allowed to be used in a certain flavor of HTML

6 0
2 years ago
Thomas has signed a deal with a production house that allows them to use his images on their website. What is required when imag
Phoenix [80]
D. Fair use. Because you need to give credit to the owner.
4 0
3 years ago
Read 2 more answers
What are the two types of computer keyboards and how are they different?
VARVARA [1.3K]
A piano keyboard
A qwerty keyboard
A Dvorak Simplified Keyboard

These are 3 types of keyboard
4 0
3 years ago
Read 2 more answers
State any three reasons why users attach speakers to your computer​
Deffense [45]

Explanation:

output device

louder volume

6 0
3 years ago
Read 2 more answers
Which of the following applications can be used as a data source for a Microsoft® Word® mail merge? A.Outlook Contacts B.Microso
Xelga [282]
<span>Word can pull data from a variety of data sources to perform a mail merge. As part of the Microsoft Office suite, Word easily accepts data from Outlook, Excel, and Access, and other data sources such as web pages, OpenDocument text files, and delimited data files stored as plain text. And if you don't have an existing data source, you can create a new one in Word.
ALL OF THE ABOVE

</span>
8 0
2 years ago
Read 2 more answers
Other questions:
  • Using social media and sending a blast are examples of
    13·1 answer
  • Google Slides saves your work to Google Drive. PowerPoint has the option to save to OneDrive. Both of these solutions are in the
    9·1 answer
  • Which language is the most popular language for writing apple os x?
    9·1 answer
  • Which zone of the ocean is deepest ?
    7·2 answers
  • If a function needs to return more than one value, as a rule of good programming style, you should change it to a(n) ___________
    6·1 answer
  • Lol who look at this so funny
    6·1 answer
  • In working on the conceptual design of the new database, Ken determines that the "office" field in one of the tables must includ
    8·1 answer
  • 7.2.4 Area of Triangle HELP PLEASE!! (JAVA SCRIPT) I WILL WAIT FOR THE SOLUTION.
    12·1 answer
  • A _____________ delivers all the files that form web pages
    13·1 answer
  • Which option is an example of an algorithm that is used in daily life?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!