answer.
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
andreyandreev
1 month ago
8

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. Remember that print() automatically adds a newline.
Computers and Technology
1 answer:
maria [1K]1 month ago
3 0

Answer:

In Python:

def print_popcorn_time(bag_ounces):

   if bag_ounces < 3:

       print("Too small")

   if bag_ounces > 10:

       print("Too large")

   else:

       print(str(6 * bag_ounces)+" seconds")

       

Explanation:

This defines the function

def print_popcorn_time(bag_ounces):

This checks if bag_ounces < 3

   if bag_ounces < 3:

If true, it outputs too small

       print("Too small")

This checks if bag_ounces > 10

   if bag_ounces > 10:

If true, it outputs too big

       print("Too large")

If not,

   else:

Calculates bag_ounces multiplied by 6 and displays the result

       print(str(6 * bag_ounces)+" seconds")

You might be interested in
You are given a string of n characters s[1 : : : n], which you believe to be a corrupted text document in which all punctuation
ivann1987 [1066]

Response: explained in the explanation section

Explanation:

Given that:

Assume D(k) =║ true if [1::: k] is a valid sequence of words, or false otherwise

  • In determining D(n)

the sub problem s[1::: k] is a valid sequence of words IFF s[1::: 1] is valid and s[ 1 + 1::: k] is a valid word.

Thus, we derive that D(k) is defined by the following recurrence relation:

D(k) = ║ false max(d[l] ∧ DICT(s[1 + 1::: k]) otherwise

Algorithm:

Valid sentence (s,k)

D [1::: k]             ∦ array of boolean variables.

for a ← 1 to m

do;

d(0) ← false

for b ← 0 to a - j

for b ← 0 to a - j

do;

if D[b] ∧ DICT s([b + 1::: a])

d (a) ← True

(b). Algorithm Output

      if D[k] == True

stack = temp stack            ∦stack assists in displaying the strings in order

c = k

while C > 0

stack push (s [w(c)]::: C] // w(p) denotes the index in s[1::: k] of the valid word // at position c

P = W (p) - 1

output stack

= 0 =

cheers, I hope this aids you!!!

8 0
23 days ago
During normal Windows operations, you receive a BSOD, and your computer shuts down. You restart the computer and receive the err
Amiraneli [1052]
The correct answer to this query is "Hard drive." Explanation: Given the context of the inquiry, it's suggested that the most likely cause of this issue is the improper connection of the video cable. An incorrectly connected video cable can lead to display disruptions, such as the screen flashing black. While overheating of the GPU could also be a potential cause, it typically results in visual artifacts rather than shifting displays. Therefore, "Hard drive" is indeed the right answer.
4 0
23 days ago
A file concordance tracks the unique words in a file and their frequencies. Write a program that displays a concordance for a fi
oksian1 [950]

Answer:

Below is the Python code with suitable comments.

Explanation:

#Input file name acquisition

filename=input('Enter the input file name: ')

#Opening the input file

inputFile = open(filename,"r+")

#Dictionary definition.

list={}

#Read and split file content using a loop

for word in inputFile.read().split():

#Check if the word exists in the file.

if word not in list:

list[word] = 1

#Increment count by 1

else:

list[word] += 1

#Closing the file.

inputFile.close();

#Output a blank line

print();

#Sorting words according to their ASCII values.

for i in sorted(list):

#Display unique words along with their

#frequencies in alphabetical order.

print("{0} {1} ".format(i, list[i]));

3 0
1 month ago
Chris accidentally steps on another student’s foot in the hallway. He apologizes, but the other student does not want to hear it
Rzqust [1037]

Answer:

He ought to report to a trusted adult and seek a resolution to the issue.

Explanation:

The situation could escalate and potentially involve others as well.

7 0
9 days ago
Read 2 more answers
An employee of a large corporation remotely logs into the company using the appropriate username and password. The employee is a
Natasha_Volkova [1026]

Respuesta: Te proporcioné 6 opciones de las cuales puedes elegir.

Integridad

Escalabilidad

Calidad de Servicio

Tolerancia a Fallos

Redes de Línea Eléctrica

Seguridad

6 0
1 month ago
Other questions:
  • When you add a zero to the right of a decimal number, it multiplies its value by 10 (For example, "15" becomes "150"). What simi
    10·1 answer
  • Start with the following Python code. alphabet = "abcdefghijklmnopqrstuvwxyz" test_dups = ["zzz","dog","bookkeeper","subdermatog
    13·1 answer
  • How to code 2.9.5: Four colored triangles {Code HS}
    10·1 answer
  • What are the 2 things you are not sure about evaluating functions​
    7·2 answers
  • A data analyst is using the Color tool in Tableau to apply a color scheme to a data visualization. They want the visualization t
    13·1 answer
  • Write a class named Taxicab that has three **private** data members: one that holds the current x-coordinate, one that holds the
    9·1 answer
  • An Internet user has a need to send private data to another user. Which of the following provides the most security when transmi
    14·2 answers
  • How has the development of personal computer hardware and software reversed some of the trends brought on by the industrial revo
    15·1 answer
  • The piston engine uses the ________ to convert the reciprocating motion of the piston into rotary motion.
    13·1 answer
  • Flowgorithm, Design a program that prompts the user to enter a number within the range of 1 through 10. The program should displ
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!