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
Grace [21]
3 years ago
13

Write a Python function that takes as input a list, A, and returns two lists L and G. L constains all numbers in A, which are no

t A[0] and are less than or equal to A[0]. G contains all numbers in A, which are not A[0], and are greater than A[0].
Computers and Technology
1 answer:
DiKsa [7]3 years ago
8 0

Answer:

In Python:

def split(A):

   L=[]; G=[]

   for i in range(1,len(A)):

       if (A[i] != A[0] and A[i] < A[0]):

           L.append(A[i])

       if (A[i] != A[0] and A[i] > A[0]):

           G.append(A[i])

   return L, G

Explanation:

This defines the function

def split(A):

This initializes the L and G lists

   L=[]; G=[]

This iterates through the original list A

   for i in range(1,len(A)):

This populates list L using the stated condition

<em>        if (A[i] != A[0] and A[i] < A[0]):</em>

<em>            L.append(A[i])</em>

This populates list G using the stated condition

<em>        if (A[i] != A[0] and A[i] > A[0]):</em>

<em>            G.append(A[i])</em>

This returns the two lists L and G

   return L, G

You might be interested in
Which of the following algorithmic efficiencies would be considered LEAST efficient?
LenaWriter [7]

Answer:exponential

Explanation: I believe

8 0
3 years ago
Please hurry Arrange the steps of the engineering design process in the correct sequence.
AnnZ [28]

Answer:The Nine steps  of the engineering design process

  1. <u>Identify the Problem</u>-Defining the problem
  2. Finding solutions through Brainstorming technique
  3. Conducting a background research/Survey
  4. Developing the solution-Creating an array of solutions
  5. Selecting the best solution
  6. Building a prototype
  7. Testing and redesigning
  8. Improve the design-Specifying the requirement
  9. Communicating the result

6 0
3 years ago
An academic or professional blog would be especially useful in which of the following fields?
Vesna [10]
Blogs, even academic and professional, are not usually considered reliable sources. Most importantly, that's because they don't undergo the peer review process, which ensures the quality of the published papers (that they don't publish lies, in simple words).

So usually, you would prefer a published paper.

When then would you use a blog?
One such instance is when you want to find out about a quickly changing field , for example the newest standards in software development. So software engineering is one such field.

Another field is internet protection and security, as the viruses and the ways to defend against them also develop faster than can be published in a paper
7 0
3 years ago
Read 2 more answers
Write a program (Console or GUI) that determines the change to be dispensed from a vending machine. An item in the machine can c
Stells [14]

Answer:

Here is the JAVA program:

import java.util.Scanner;  //to accept input from user

public class Main {   //class name

  public static void main(String[] args) {  //start of main function

Scanner input =new Scanner(System.in);  // creates Scanner class object

int amount, quarters, dimes, nickels, pennies,change;   //declare variables

System.out.println("Enter the price of the(from 25 cents to a dollar, in 5-cent increments): ");  //prompts user to enter the price

amount=input.nextInt();   //reads amount from user

change= 100-amount;   //computes change

System.out.println("You bought an item for " + amount+" cents and gave me a dollar, so your change is :");  

quarters=change/25;  //computes quarters

change=change%25;  //computes quarter remaining

if(quarters == 1)   // if quarter is equal to 1

System.out.println(quarters+ " quarter");   //prints quarter value in singular

else if (quarters>1)   // if value of quarters is greater than 1

System.out.println(quarters+" quarters");     //prints plural quarters value

dimes=change/10;  //computes dimes

if(dimes == 1)   // if value of dime is equal to 1

System.out.println(dimes+ " dime");   //prints single value of dimes

else if (dimes>1)   //if value of dimes is greater than 1

System.out.println(dimes+" dimes");  //prints plural value of dimes

change=change%10;   //computes dimes remaining

nickels=change/5;  //computes nickels

if(nickels == 1)   //if value of nickels is equal to 1

System.out.println(nickels+ " nickel");   //prints single value of nickels

else if (nickels>1)   //if value of nickels is greater than 1

System.out.println(nickels+" nickels");   //prints plural value of nickels

change=change%5;    //computes nickels remaining

pennies=change;  //computes pennies

if(pennies == 1)   //if value of pennies is equal to 1

System.out.println(pennies+ " penny");   //prints single value of pennies

else if (pennies>1)    //if value of pennies is greater than 1

System.out.println(pennies+" pennies");     } }  //prints plural value of pennies

Explanation:

I will explain the program with an example:  

Suppose amount= 75  

Then change = 100 - amount= 100 - 75 = 25  

change = 25  

quarters = change/25 = 25/25 = 1  

quarters = 1  

change = change % 25 = 25%25 = 0  

dimes = 0/10 = 0  

Now all other values are 0.  

Now the following line is printed on screen:  

You bought an item for 75 cents and gave me a dollar. Your change is:  

Now program moves to if part  

if quarters == 1  

This is true because value of quarter is 1  

sot "quarter"   is displayed with the value of quarters

Now the following line is printed on screen:  

1 quarter  

So the complete output of the program is:  

You bought an item for 75 cents and gave me a dollar. Your change is:  

1 quarter

3 0
4 years ago
Write a flowchart and C code for a program that does the following: Uses a do...while loop. Prints the numbers from 1 to 10 with
emmasim [6.3K]

Answer:

create the integer variable and initialize it to one, with the do statement, increment the variable by one and print it, then the while statement checks if the variable is less than or equal to 10.

#include <iostream>

using namespace std;

int main(){

   int i = 1;

   do {

       cout<< i << "\n";

       i++;

   }

   while (i <= 10);

}

Explanation:

The C++ source code initializes the integer variable i to one and increments and print the value if the value is less than or equal to ten. The do-while statement executes a block of code before the condition is implemented.

4 0
3 years ago
Other questions:
  • What kind of voltage do solar cells generate? Solar cells produce ______ voltage which is not usable by most household appliance
    15·1 answer
  • What is the correct syntax to take the first five characters from the cell and place to its right in cell A3?
    15·1 answer
  • You have installed five new 300 GB disk drives into a server running Windows Server 2012. You want to create a volume that will
    15·1 answer
  • Which do switches create?<br> Networks<br> Wireless access points<br> Routes<br> Collision domains
    5·1 answer
  • Help me, please! No links btw :)
    9·2 answers
  • ANSWER ASAP IF CORRECT I GIVE BRAINLIEST
    7·2 answers
  • What is the largest software application on a computer?
    15·2 answers
  • Yazmin is reading a book that has 74 pages. She has read 38 pages. How many more pages does she need to read to finish the book​
    6·1 answer
  • Which type of measurement would you use to determine the mass of sugar?
    12·1 answer
  • Iris has completed a graphic design project for a client. what should iris obtain from the client in order to display the work i
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!