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
How can a chart help to display your data? How does one choose the best type of chart to use, and how does one ensure that he or
Kay [80]
I think this should be under math. So let's say that you have tons of data and you need to sort it. A chart will help to graph that data in an organized formation.
6 0
3 years ago
Jack has a fear of getting up in front of a group of people and giving a presentation. When he gave his last presentation, he ta
dezoksy [38]

Answer:

Jack has to be very calm and try his best to present himself in an outward way and think about the fact that by the end of the night no one will remember that he messed up, I feel like he'll be okay :)

7 0
2 years ago
Read 2 more answers
Utilizando o padrão de medidas e unidades do National Institute of Standards and Technology, em que 1 KB é igual a 1.000 Bytes,
Tanya [424]

Segundo o padrão da  National Institute of Standards and Technology a  alternativa correta é a letra E) 400 músicas.  Segundo o padrão disposto acima, dois Giga Bytes equivalem à dois mil Mega Bytes, assim, se cada música tem exatos 5MB, podemos chegar ao total de músicas que podem ser gravadas em um PenDrive de 2GB livres do seguinte modo :

x=\frac{2000 MB}{5MB};x=400

 A evolução da microeletrônica possibilitou uma capacidade de armazenamento cada vez maior a cada ano. O desenvolvimento de novas tecnologias na área permite também que os produtores possam produzir músicas, fotos e vídeos com cada vez mais qualidade (consequentemente mais pesada).

5 0
2 years ago
.true or false? one disadvantage of cloudware is that it is never free<br> A. true<br> B. false
ser-zykov [4K]

Answer:

true

Explanation:

cloudware is used for many reasons and It is sometimes too much of an expense to the company

7 0
2 years ago
Which part of project management involves determining the required materials?
Katyanochek1 [597]
Resources I think because what u have all depends on resources
5 0
3 years ago
Read 2 more answers
Other questions:
  • How many spaces is equal to one tab on a keyboard? When I compose emails, the tab button doesn't indent for me, so how many time
    7·1 answer
  • What technology process would help you access files at all times?
    11·1 answer
  • What is the meaning for science?
    14·1 answer
  • ________ are websites that provide collections of content from all over the world wide web a. aggregators b. social networks c.
    6·1 answer
  • list the six external parts or "peripherals" of a computer system and identify which are output and which are input devices.
    15·1 answer
  • Michael needs to ensure that those items that are automatically archived are still easily accessible within Outlook. Which optio
    7·2 answers
  • WILL MARK BRAINLIEST!!!!!!!!!!!
    6·2 answers
  • It's generally best to use what types of sites for factual internet research? Select all that apply from the choices below.
    5·2 answers
  • processing C. have only one function, e.g. control traffic lights in a town, games machines 7 To create a formula, you first: A.
    13·1 answer
  • My assignment asks me to write a python program using if, elif, and else that takes a user's salary and calculates the tax based
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!