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]
2 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]2 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
What are two fundamental components of data structures?
Fed [463]
Organization and access method.

Hope this helped! :)

- Jujufire
8 0
3 years ago
You can invoke or call a method from another program or method. When methods must share data, you can pass the data into and ret
san4es73 [151]

Answer:

1. You can invoke or call a method from another program or method: TRUE

2. When methods must share data, you can pass the data into and return the data out of methods: TRUE

3. A method could be called using any numeric value as an argument, whether it is a variable, a named constant, or a literal constant: TRUE

Explanation:

4 0
3 years ago
Choose the correct definition for Conditional Statement A. Affects the sequential flow of control by executing different stateme
Sliva [168]

Answer:

A: Affects the sequential flow of control by executing different statements based on the value of a Boolean expression

Explanation

because the real definition is Definition. A conditional statement is a statement that can be written in the form “If P then Q,” where P and Q are sentences. For this conditional statement, P is called the hypothesis and Q is called the conclusion. Intuitively, “If P then Q” means that Q must be true whenever P is true. And A, explain that.

5 0
3 years ago
Read 2 more answers
All HTML5 webpages must begin with the HTML element _____.
Paul [167]

Answer:

yes, an HTML webpage must begin with an HTML element

Explanation:

<HTML> <!-- Website Content --> </HTML>

3 0
2 years ago
A piece of glass has a thin film of gasoline floating on it. A beam of light is shining perpendicular on the film. If the wavele
kobusy [5.1K]

Answer:

200 nm

Explanation:

We need a constructive interference to see the bright reflection

we know that 2t=m\lambda  where m=1 and \lambda is the wavelength of the gasoline

so \lambda =\frac{560}{1.4}=400nm

putting the value of m and \lambda in thickness equation

t=\frac{1\times 400}{2}=200nm

so the thickness of the film will be 200 nm

3 0
3 years ago
Other questions:
  • Which of the following is the core of an operating system that maintains the computer’s clock, starts applications, and assigns
    7·1 answer
  • List 3 items that were on kens resume that should have been excluded
    13·2 answers
  • How can you have a safe browser experience
    9·1 answer
  • What should a password policy contain to reduce a hackers ability to crack the passwords?
    10·1 answer
  • Ted knows that macros can be helpful to him in his work with Excel spreadsheets,but he also knows they have their hazards,so he
    15·1 answer
  • According to which virtue do you need to secure information by limiting computer access to authorized personnel only?
    6·1 answer
  • Nonprogrammed decision
    7·1 answer
  • What is text formatting?​
    5·2 answers
  • Why is the Microsoft website considered the best source for information about pagefile.sys?​
    15·1 answer
  • Giusp minfg gấp vs ạ đáp án thôi nhé
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!