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
Write a program that prints the number 1 through 10 using a while loop
vova2212 [387]
Which programming language are you working in?

Here is how you could achieve this in Python:

establish a counter, starting at 1.
While your counter is 10 or less, do two things:
print the counter,
and increase the counter by 1.

code:
counter = 1

while counter <= 10:
print(counter)
counter = counter + 1

Those last two lines should be indented.
7 0
3 years ago
Czy FALL GUYS będzie działało szybko na i5 GH8? Na ilu FPS?
Lesechka [4]

Answer:español por favor asi te responderé y gracias por los 10 puntos chaoo

Explanation:

6 0
2 years ago
Identify the modern-day printmaking process, also known as screenprinting, in which the artist squeegees paint through a mesh sc
aliya0001 [1]
Serigraphy is another word for this!
5 0
3 years ago
A program that will read each player’s name and golf score as keyboard input,
PtichkaEL [24]
Use for loop and question inside it
7 0
2 years ago
1) Put the following in order from smallest to largest A) 1,500,000 bytes B) 2,000 kilobytes C) 0.01 petabytes D) 1 Terabyte E)
Lyrx [107]

Answer:

A, B, E, D, F, C

3 0
2 years ago
Other questions:
  • What is the full form of the acronym WWW?
    13·2 answers
  • 22 If you are involved in a violation and you do not have insurance to comply with the __________________, your driver license a
    9·2 answers
  • Give a logical expression with variables p,q, and r that is true if p and q are false and r is true and is otherwise false.
    5·1 answer
  • How important is the mail merge feature of microsoft word in different organization.?
    8·2 answers
  • Command create database in oracle database ::((
    8·1 answer
  • What is Celeste? ( This is for my coding class )
    6·2 answers
  • Write a function that dynamically allocates an array of integers. The function should accept an integer argument indicating the
    8·1 answer
  • Josh needs to write a research report for his Civics class. Which file type will allow him to save his file? (5 points)
    12·1 answer
  • What stipulates that the source code of any software published under its license must be freely available.
    14·1 answer
  • One of 34 possible _________________ can be assigned to each axis of classification in the seven-character code.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!