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
Margaret [11]
3 years ago
9

The function below takes a single parameter number_list which is a list that can contain integers and floats. Complete the funct

ion to return the integer from the provided list that is the largest. There are two recommended approaches for this function. You could either filter out just the integers and use Python's built-in max function, or you could use the find best pattern and only consider list elements that are integers as potentially being the best.
Computers and Technology
1 answer:
Andreas93 [3]3 years ago
6 0

Answer:

  1. def getLargest(number_list):
  2.    new_list = []
  3.    for x in number_list:
  4.        if(isinstance(x, int)):
  5.            new_list.append(x)
  6.    largest = max(new_list)
  7.    return largest  

Explanation:

Firstly, create a function <em>getLargest()</em> that take one input parameter, <em>number_list</em>.

The function will filter out the float type number from the list by using <em>isinstance() </em>method (Line 5). This method will check if a current x value is an integer. If so, the x value will be added to <em>new_list</em>.

Next, use Python built-in <em>max</em> function to get the largest integer from the <em>new_list </em>and return it as output.

You might be interested in
When using a wireless mouse, what is the most common port used for the transmitter? 
larisa [96]
Your answer is B. USB
7 0
2 years ago
In the single-site processing, single-site data (SPSD) scenario, all processing must be done on the end user's side of the syste
Lyrx [107]

Answer:

The answer is "Option B".

Explanation:

In the database, the term SPSD is used. It is located on the host computer that helps to access connected dumb terminals. It is usually running on under multitasking, time-sharing operating systems, that enables you to use multiple processes to run simultaneously on a host computer accessing a single DP. It is not used for end user's sides, that's why it is not correct.

3 0
2 years ago
Read 2 more answers
Overlay analysis is ____________, taking in data from two or more layers to create a single output layer.
Wewaii [24]

Explanation:

Overlay analysis is an approach, taking in data from two or more layers to create a single output layer.

For example, if we have a layer of land use and a layer of soil fertility, we can derive from the two layers the percentage of agricultural land developed over fertile soil.

6 0
3 years ago
A computer supply company is located in a building with three wireless networks.
Sonja [21]

Answer:

A. Rogue access point

Explanation:

A rogue access point is defined as a wireless access point installed on a secure network infrastructure without consent of the owner of the network or without due authorization. While this can sometimes be added by a malicious attacker, it is most commonly set up by employees with the desire to have wireless access even when there is any available.

In the question, there are three wireless networks, but on scanning, five wireless networks were found, hence they are rogue access point.

3 0
3 years ago
A contiguous subsequence of a list S is a subsequence made up of consecutive elements of S. For example, if S is 5,15,-30,10,-5,
Sindrei [870]

Answer:

We made use of the dynamic programming method to solve a linear-time algorithm which is given below in the explanation section.

Explanation:

Solution

(1) By making use of the  dynamic programming, we can solve the problem in linear time.

Now,

We consider a linear number of sub-problems, each of which can be solved using previously solved sub-problems in constant time, this giving a running time of O(n)

Let G[t] represent the sum of a maximum sum contiguous sub-sequence ending exactly at index t

Thus, given that:

G[t+1] = max{G[t] + A[t+1] ,A[t+1] } (for all   1<=t<= n-1)

Then,

G[0] = A[0].

Using the above recurrence relation, we can compute the sum of the optimal sub sequence for array A, which would just be the maximum over G[i] for 0 <= i<= n-1.

However, we are required to output the starting and ending indices of an optimal sub-sequence, we would use another array V where V[i] would store the starting index for a maximum sum contiguous sub sequence ending at index i.

Now the algorithm would be:

Create arrays G and V each of size n.

G[0] = A[0];

V[0] = 0;

max = G[0];

max_start = 0, max_end = 0;

For i going from 1 to n-1:

// We know that G[i] = max { G[i-1] + A[i], A[i] .

If ( G[i-1] > 0)

G[i] = G[i-1] + A[i];

V[i] = V[i-1];

Else

G[i] = A[i];

V[i] = i;

If ( G[i] > max)

max_start = V[i];

max_end = i;

max = G[i];

EndFor.

Output max_start and max_end.

The above algorithm takes O(n) time .

4 0
2 years ago
Other questions:
  • Tower defense is included under which genre of game
    15·2 answers
  • 5. What would the browser display if the following code were executed in a script?a var product = 0; while ( product &lt;= 25 );
    8·1 answer
  • How long does it take a letter to arrive?
    9·1 answer
  • What will the following program display?
    15·1 answer
  • What is the Documenter?
    10·1 answer
  • Suppose that f is a function with a prototype like this: void f(________ head_ptr); // Precondition: head_ptr is a head pointer
    6·1 answer
  • Illusions in physcology​
    14·1 answer
  • . A store offers a deposit of 6% on the cash price of $462. The deposit amount is?​
    6·1 answer
  • An array, numbers, of integers is filled with 100 random numbers whose values are greater than 10 and less than 255. You DO NOT
    7·1 answer
  • A Development team begins work on a new software application and decides to involve the client’s IT experts to ensure that secur
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!