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 type of network is the internet
shtirl [24]

Answer:

The internet is considered as Wide Area Network (WAN).

5 0
3 years ago
Ano ang word processor at electronic spreadsheet​
AveGali [126]

Answer:

excel

Explanation:

3 0
3 years ago
Read 2 more answers
Which type of storage disk and disk drive can you use in the given situation?
Margarita [4]

Answer:

The answer to this question is DVD and DVD-RW

Explanation:

6 0
3 years ago
Demonstrate how to write each condition as an if-else in Java. If yes, then the computer should print “The answer is A,” “The an
konstantin123 [22]

\tt x=(float(input("Enter\;your\:answer")))

\tt if\:x=A:

\qquad\tt print("The\:answer\:is\:A")

\tt elif\::

\tt x=B;

\qquad\tt print("The\:answer\:is\:B")

\tt x=C;

\qquad\tt print("The\:answer\:is\:C")

\tt else\::

\qquad\tt print("The\:answer\:is\:not\:here")

4 0
2 years ago
In the 1800s, the Know-Nothing Party worked to accomplish which of the following?
s2008m [1.1K]

Answer:

C

Explanation:

The know-nothing party was a strong anti catholic party and anti-immigration party, so that rules out the first option. Also we can rule out the second and last options because they have less to do with the party. The answer would be C.

4 0
3 years ago
Other questions:
  • Sleeping is an effect of _______ , but agitation may cause a person to wake up
    7·2 answers
  • "where is a cookie that is created during a web site visit​ stored?"
    9·1 answer
  • 1D Array Assignment Outcome: Student will demonstrate the ability to use a one-dimensional array. Student will demonstrate the a
    5·1 answer
  • If you see ________________________ in a cell, it means the column is not wide enough to display the cell content. Select one: a
    15·1 answer
  • Martha and her project group want to present the class their work in the form of a slideshow that includes charts. Which applica
    9·1 answer
  • An attacker tried to hack into the database of a reputed organization. The attacker inserted malicious code into the query of a
    14·1 answer
  • Write 2 paragraphs. 1 comparing Shrek the movie and Shrek the musical and another contrasting them.
    12·2 answers
  • Which of the following shows data conversion taking place?
    12·1 answer
  • 6
    7·2 answers
  • Please answer quick :(​
    14·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!