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
Write the definition of a function that takes as input the three numbers. The function returns true if the first number to the p
sattari [20]

Answer:

I am writing a C++ program.

Here is the function CheckPower() which is a bool return type function which means it will return either true of false. This function has three double type parameters. This function returns true if the first number to the power of the second number equals the third number; otherwise, it returns false.

bool CheckPower(double number1, double number2, double number3)

{

   double power; // stores value of number1 to the power number2

   power = pow(number1,number2); // pow() function to computer power

   if (power==number3) // if the value of power is equal to third no number3

       return true; // returns true

   else // if above condition evaluate to false then returns false

       return false;

}

Explanation:

Lets take the values of number1 = 3, number2 = 2 and number3 = 9 to understand the above function.

The pow() function is a power function to calculate the result of number1 raised to the power of number2. Here number1 is the base number and number2 is exponent number. As number1 = 3 and number2 = 2 so this is equivalent to 3² . So 3 raise to the power 2 is 9. The value stored in power is 9.

power = 9

Next, the if condition checks if the value in power is equal to the value of number3. The value of number3 is 9 and the value in power variable is also 9 so the If condition evaluates to true. So the if part is executed which returns true.

If the value of number3 is, lets say, 10 then the If condition evaluates false as the value of power is not equal to value of number3. So the else part is executed which returns false.

If you want to see the output of this function you can write a main() function as following:

int main()

{   double num1, num2, num3;

   cout << "enter first number: ";

   cin >> num1;

   cout << "enter second number: ";

   cin >> num2;

   cout << "enter third number: ";

   cin >> num3;

   if(CheckPower(num1, num2, num3))

   { cout<<"True";    }

   else

   { cout<<"False";  }    }

This is a main() function which asks the user to enter the values of three numbers num1, num2 and num3. The if condition calls CheckPower() function to check if the first number to the power of the second number equals the third number. If this condition evaluates to true, the message True is displayed on the screen otherwise message False is displayed on output screen.

The screen shot of program along with its output is attached.

3 0
3 years ago
As Alexa types a message, Outlook autosaves the message at various points. In which folder is the message located if Alexa wants
alexgriva [62]

Answer:

Draft

Explanation:

Draft is a specific folder in email that is meant to store partially finished mails and mails which has been created but is not sent .  Draft folders helps in reducing rework on the mail if one is interrupted while writing the mail. Another purpose of draft folder was that if anyone accidentally closes the  mail writing section then the content of mail is not lost and can be easily be obtained in draft folder. It also helps in tracking unsent and unfinished mail for the user.

Since, message written by Alexa is saved at different points but is not sent then if the mail is to be sent, then one needs to look for that mail in Draft folder.

5 0
2 years ago
Read 2 more answers
Describe software as a service. what features distinguish it from application software installed on a personal computing device
Triss [41]
???????????????????????????
6 0
3 years ago
Read 2 more answers
A person is trying to remember a list of 12 different items:
erastova [34]

Answer:

for me personally, it would help if the items were rearranged with like items, for example: snow, sleet, rain, and hail would go together.

so the list should look something like this:

    <u>weather conditions</u>

  • snow
  • sleet
  • hail
  • rain

    <u>fruits</u>

  • strawberry
  • banana
  • apple
  • orange

   <u>sports</u>

  • football
  • soccer
  • tennis
  • rugby

hope i helped <3 have a nice day

5 0
3 years ago
Read 2 more answers
What is a plan that details how a company creates, delivers, and generates revenues on the Internet?
mariarad [96]

Answer:

E-business model.

Explanation:

E-business model is a strategy that outlines how an organization produces, provides and yields Online revenues.

The e-business model is the path that a firm requires towards becoming a successful online business. There are several catchphrases describing facets of digital business and also there are categories in the business-to-consumer sector, such as service providers, auction sites and perfect-play Online retailers.

6 0
3 years ago
Other questions:
  • A short-circuit evaluation is where each part of an expression is evaluated only as far as necessary to determine whether the en
    14·1 answer
  • It is a function that ends the connection to the database.
    9·2 answers
  • A network administrator is required to upgrade wireless access to end users in a building. To provide data rates up to 1.3 Gb/s
    12·1 answer
  • The ability to anticipate and determine upcoming driving hazards and conditions are adversely affected
    14·1 answer
  • On the Attendance worksheet, in cell L5, enter an IF function to determine if the percentage in cell K5 is greater than or equal
    9·1 answer
  • Suppose that a computer can read or write a memory word in 5 nsec. Also suppose that when an interrupt occurs, all 32 CPU regist
    10·2 answers
  • PLEASE HELP ASAP<br> Which technology encrypts traffic between a web browser and a website?
    10·2 answers
  • 1. If an F# function has type 'a -&gt; 'b when 'a : comparison, which of the following is not a legal type for it? Select one:
    14·1 answer
  • Write any one method to delete a table in writer​
    11·1 answer
  • 90 POINTS Hazel is working with a database to help determine if the company she works for is making or losing money. Hazel has o
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!