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
Nataly [62]
3 years ago
5

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. Sample output with input: 7 42 seconds
Computers and Technology
1 answer:
Lynna [10]3 years ago
4 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("%s Seconds\n" % bag_ounces)    

Explanation:

  • Using Python Programming Language
  • The function is defined to accept an int parameter
  • Within the function body, if...elif and else statements are used to print the desired output
  • note the use of the %s placeholder (formated output) and \n for a new line in the final print statement
You might be interested in
Using a tag, set the color to orange for all tags
photoshop1234 [79]

Answer:

ok

Explanation:

5 0
3 years ago
Read 2 more answers
Ethan wants to change the font in his document. He should _____.
guapka [62]

Answer:

C because it will work. I tried that a lot of time with documents.

Explanation:

6 0
3 years ago
PLEASE HELP!
Alex73 [517]
The Filter function will allow her to quickly find this data. It is not impossible using the Sort function, but it will take much longer and involve a lot of manual cutting, pasting or deleting of unnecessary data.


D.)Laura can apply a Filter for the top 10 students and a Filter for which schools to exclude from the results.
5 0
3 years ago
Read 2 more answers
Create and Provide complete program that includes a comments header with your name, course, section and other program details an
agasfer [191]

Answer:

Written using C++

/*Enter Your Details Here*/

#include<iostream>

#include<cmath>

using namespace std;

int main()

{

//1

float side;

cout<<"Enter the side of a square: ";

//2

cin>>side;

//3

float perimeter = 4 * side;

cout<<"The perimeter is "<<perimeter<<endl;

//4

float area = side *side;

cout<<"The area is "<<area<<endl;

//5

float diagonal = sqrt(2 * side * side);

cout<<"The length of the diagonal is "<<diagonal;

return 0;

}

Explanation:

<em>I've added the full source code as an attachment where I used more comments to </em><em>explain </em><em>difficult line</em>

Download cpp
7 0
3 years ago
Write a recursive method named binarySearch that accepts a sorted array of integers and an integer target value and uses a recur
djyliett [7]

Answer:

10

-1

Process finished with exit code 0

Explanation: see code bellow

public class BinarySearchRecursive {

   public static int binarySearch(int[] a, int key) {

       return binarySearchRecursiveHelper(a, key, 0, a.length - 1);

   }

   public static int binarySearchRecursiveHelper(int[] arr, int target, int start, int end) {

       if (start > end) {

           return -1;

       }

       int mid = (start + end) / 2;

       if (arr[mid] == target) {

           return mid;

       } else if (target < arr[mid]) {

           return binarySearchRecursiveHelper(arr, target, start, mid - 1);

       } else {

           return binarySearchRecursiveHelper(arr, target, mid + 1, end);

       }

   }

   public static void main(String[] args) {

       int[] a = {-4, 2, 7, 10, 15, 20, 22, 25, 30, 36, 42, 50, 56, 68, 85, 92, 103};

       int index = binarySearch(a, 42);   // 10

       System.out.println(index);

       index = binarySearch(a, 66);   // -1

       System.out.println(index);

   }

}

6 0
2 years ago
Other questions:
  • True are fulse A piece of information that is considered common knowledge does not need a citation
    5·2 answers
  • Themes are applied from which tab?
    6·1 answer
  • To determine the average of a range of numbers, click the ____ in the formula bar, then click average.
    13·1 answer
  • By the 1990s, ______________ technology enabled one person operating a desktop computer to control most—or even all—of these fun
    8·2 answers
  • Where on the internet can you find a site that will allow you to tour bill gates mansion
    8·2 answers
  • Is it good to work out at the gym one day with hands then the next with feet, then a pattern?
    11·2 answers
  • Briefly describe the traditional definition of the digital divide. What is it and who is affected, positively and adversely? How
    15·1 answer
  • Help me guys plssssss​
    10·1 answer
  • What is the advantage of entering metadata for electronic records that you create
    7·1 answer
  • scheduling is approximated by predicting the next CPU burst with an exponential average of the measured lengths of previous CPU
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!