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
SVETLANKA909090 [29]
3 years ago
14

Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print "Too small". If greater than

10, print "Too large". Otherwise, compute and print 6 * bag_ounces followed by "seconds". End with a newline.
Computers and Technology
2 answers:
yawa3891 [41]3 years ago
8 0

Answer:

void print_popcorn_time(int bag_ounces){

   if(bag_ounces < 3){

       cout<<"Too small"<<endl;

   }else if(bag_ounces > 10){

       cout<<"Too large"<<endl;

   }else{

       cout<<(6 * bag_ounces)<<"seconds"<<endl;

   }

}

Explanation:

The function is the block of the statement which performs the special task.

For checking the condition in the program, the if-else statement is used.

It can check the condition one or two but if we want to check the more than two different conditions then the continuous if-else statement is used.

syntax of continuous if else:

if(condition){

statement;

}else if(condition)

statement;

}else{

statement;

}

In the question, there are three conditions;

1. bag_ounces is less than 3

2. bag_ounces greater than 10

3. else part.

we put the condition in the above if-else statement and print the corresponding message.

erastova [34]3 years ago
5 0

Answer:

def print_popcorn_time(bag_ounces):

   if bag_ounces < 3:

       print("Too small")

   elif bag_ounces > 10:

        print("Too large")

   else:

        bag_ounces = bag_ounces * 6

        print(bag_ounces, "seconds")

Explanation:

def print_popcorn_time(bag_ounces): #fed function

   if bag_ounces < 3:  #1st if statement

       print("Too small") #print function

   elif bag_ounces > 10: #else if

        print("Too large") #print than print

   else:  #else:

        bag_ounces = bag_ounces * 6 #do work

        print(bag_ounces, "seconds") #print

You might be interested in
Briefly explain how developers use a distributed version management system. You may assume that a master repository has been set
Akimi4 [234]

Answer:

Using version control tools like Git and Github.

Explanation:

Version control is a vital tool in programming in recent times. it helps to prevent loss of source codebase and creating unwanted folders for storing multiple codebases to prevent excess storage usage and time consumption.

Git and Github is a platform that handles version control and collaboration between co-workers. When a repository is created, its initial branch is called the master branch and when a staged code is committed, the commit is recorded. These records can be retrieved using the commit hash value and resetting the current unstaged file or code. A new branch can created to hold a different version of an application and merged later with the master branch.

4 0
3 years ago
Write the following short piece of code in python:
elena55 [62]

Programmers refer to a brief section of reusable source code, machine code, or text as a “snippet.” These are typically explicitly defined operational units that are integrated into bigger programming modules.

<h3>What are the short piece of code in python?</h3>

Guido van Rossum created Python, an interpreted, object-oriented, high-level programming language with dynamic semantics. It was first made available in 1991.

The syntax of Python is straightforward and resembles that of English. Python's syntax differs from various other programming languages in that it enables programmers to construct applications with fewer lines of code.

Therefore, Python operates on an interpreter system, allowing for the immediate execution of written code. As a result, prototyping can proceed quickly.

Learn more about python here:

brainly.com/question/10718830

#SPJ1

5 0
2 years ago
1. Es un símbolo que indica que se ha de realizar cierta operación específica entre uno o varios
irina1246 [14]

Answer:

b) Operador

Explanation:

Un operador en un lenguaje de programación es un símbolo que le dice al compilador o intérprete que realice una operación matemática, relacional o lógica específica y produzca un resultado final.

En el lenguaje de programación computacional, un operador es un símbolo o construcción que se define dentro del lenguaje de programación que indica al intérprete o compilador lo lógico, relacional, matemático, a realizar sobre un valor o entre valores.

Ejemplos de operadores son;

Operador de adición; +

Operador lógico; Y

Operador de asignación; =

Operador de comparación; >

operador typeid; typeid

6 0
3 years ago
Do you want to run a listing to see files that were used by the last access date is date does not display by default which comma
FromTheMoon [43]

Considering the situation and the computer application, the command you would use to find additional properties of the files to reference is "<u>Get-childitem | get-member "</u>

<h3>What is Get-childitem command?</h3>

Get-childitem command in computer applications is used to get the items in specific locations.

Get-childitem command can be used to gets the items inside a file container, usually referred to as child items.

Similarly, the Get-member command used to gets the members, the properties, and methods of files.

Hence, in this case, it is concluded that the correct answer is <u>Get-childitem | get-member </u>

Learn more about Computer commands here: brainly.com/question/25243683

3 0
2 years ago
The underline format will underline ____.
alisha [4.7K]
<span>The underline format will underline </span>the selected text
7 0
3 years ago
Other questions:
  • You buy a $3,500 car and finance it through the car dealer. the contract says if you are two months delinquent with your payment
    9·1 answer
  • What does VERONIcA stand for?
    9·2 answers
  • In the Word 2016 window, where is the Status bar located?
    8·1 answer
  • What are the dimensions (width and height) of the largest image we can make with the pixelation widget?
    8·1 answer
  • Assume that the demand curve for DVD players shifts to the left and the supply curve for DVD players shifts to the right, but th
    6·1 answer
  • A computer connected to the Internet that asks for data is a(n) ________. Select one: A. server B. client C. aggregator D. surro
    8·1 answer
  • Which year was the Apple 2 released? <br>A) 1979 <br>B). 1973 <br>C). 1980 <br>D). 1977​
    15·2 answers
  • Given positive integer num_insects, write a while loop that prints that number doubled up to, but without exceeding 100. Follow
    6·1 answer
  • Please help.........​
    13·1 answer
  • when demonstrating 2022 versa’s maneuverability, what available systems should you point out when backing up?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!