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
Jobisdone [24]
3 years ago
9

Write an expression to print each price in stock_prices. Sample output with inputs: 34.62 76.30 85.05

Computers and Technology
1 answer:
Lana71 [14]3 years ago
4 0

Answer:

Here is the Python program:

stock_prices = input().split() #to take input and splits it into a list

for price in stock_prices: #iterates through stock_prices

   print("$",price) #prints each value of stock_prices with a dollar sign

Explanation:

The program is well explained in the attached comments. I will explain the logic of the program with the help of an example:

Suppose the user enters the following input as stock_prices values

34.62 76.30 85.05

input() method is used to take input from user

split() method is used to split or break this input string and returns a list of strings as:

['34.62', '76.30', '85.05']    

Now the statement for price in stock_prices: iterates through each item of the list and print("$",price) prints each value of list with a dollar sign on the output screen as:

$ 34.62                                                                                                            

$ 76.30                                                                                                            

$ 85.05    

You might be interested in
What is the purpose of citations?
Elina [12.6K]

Answer: Citiations areto show where you got information from.

Explanation:

6 0
4 years ago
In addition to the cost of legal services and the cost of treatment, which of the following are considered direct costs for work
Mrrafil [7]

Answer:

what are the options for the question

3 0
2 years ago
From which Menu option you can change page setup in MS Word​
marissa [1.9K]

page layout tab or the page setup dialog box

8 0
3 years ago
Harry is undertaking a digital photography course as the college and wants to
Ludmilka [50]

C. Unconventionally yes it will break down the system potentially causing a virus

4 0
3 years ago
Which command displays the status of the ipsec installation?
Alexandra [31]
Character command shows the status.
8 0
3 years ago
Other questions:
  • Define the ADT list: its properties and methods
    14·1 answer
  • Advantages of heading attributes
    5·1 answer
  • The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write a recursive
    7·1 answer
  • Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments to the bool variabl
    6·1 answer
  • The
    6·2 answers
  • Can somebody help me out
    15·1 answer
  • Anyone wanna join zoo m???????​
    10·2 answers
  • 2. The<br>is the main and usually largest data storage hardware device in a computer​
    9·1 answer
  • The idea that an object can exist separate from the executing program that creates it is called
    13·1 answer
  • Which of the following statements are TRUE about formatting images in HTML.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!