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
Dvinal [7]
3 years ago
5

The function below takes a single parameters: a list of numbers called num_list. Return a new list containing just the three lar

gest numbers (in any order). Your function shouldn't modify the original list. You can assume that the list always contains at least 3 numbers. The easiest way to accomplish this is to sort the provided data and then slice, but you'll need to make a copy of the data (so that you don't modify the original list).
print.py 1. hef three_largest numbers(num_list):
Computers and Technology
1 answer:
yarga [219]3 years ago
8 0

Answer:

  1. def three_largest_numbers(num_list):
  2.    sort_list = num_list
  3.    sort_list.sort(reverse=True)
  4.    return sort_list[0:3]
  5.    
  6. print(three_largest_numbers([5, 7, 1, 8, 9, 3, 6]))

Explanation:

Firstly, we declare a function that will take one input list, num_list (Line 1). To avoid modifying the original num_list, we create a copy of num_list and assign it to a new list, sort_list (Line 2) in the function. Next, we use Python list  sort function to sort the list in descending order (Line 3). At last, return the first three elements of the sort_list as output (Line 4).

We test the function using a sample list (Line 6) and we shall get [9, 8, 7] printed in terminal.

You might be interested in
When you run your Windows Form application, what is the lifespan of a global variable (also known as a "field" or "class" variab
Goryan [66]

The lifespan of a global variable (also known as a "field" or "class" variable) exist only until any additional classes are initialized.

<h3>What is Windows form application?</h3>

Windows Forms is defined as a form of UI backbone that is often uused for creating Windows desktop apps.

It is known to help its user in a lot of ways to produce or make  desktop apps using  the visual designer given in Visual Studio. It has a lot of Functionality such as drag-and-drop placement of visual controls and others.

See full question below

When you run your Windows Form application, what is the lifespanof a global variable (also known as a “field” or “class”variable)?

a. during the initial click button event

b. global variables only exist if they are constants

c. only until any additional classes are initialized

d.as long as the form is running

Learn more about Windows  from

brainly.com/question/26420125

5 0
2 years ago
What are the requirements of a data dictionary ?
rodikova [14]
While these are the core elements of a data dictionary, it's not uncommon to document additional information about each element, which may include the source of the information, the table or concept in which the attribute is contained, the physical database field name, the field length, and any default values.
8 0
3 years ago
Read 2 more answers
Paragraph on uses of computer 100 words plss​
Eva8 [605]

REFER TO ATTACHMENT・ᴥ・

8 0
2 years ago
Which of the following best explains how algorithms that run on a computer can be used to solve problems?
timama [110]

The statement which best explains how algorithms running on a computer can be used to solve problems is; D. Some problems cannot be solved by an algorithm.

<h3>What is an algorithm?</h3>

An algorithm is simply a standard formula or procedures which is made up of a set of finite steps and instructions that must be executed on a computer, so as to proffer solutions to a problem or solve a problem under appropriate conditions.

However, it should be noted that it is not all problems that can be solved by an algorithm, especially because the required parameters and appropriate conditions are not feasible or met.

Read more on algorithm here: brainly.com/question/24793921

7 0
2 years ago
5 differences between a regular mouse and a gaming mouse​
alexdok [17]

Answer:

A gaming mouse has more buttons to keybind to while a regular mouse is simpler

Explanation:

6 0
2 years ago
Other questions:
  • witch of the following is a good way to choose your location as you develop your study method? A. Going where most of your frien
    6·1 answer
  • How did the discovery of glossopteris support wegner's continental drift hypothesis?
    15·1 answer
  • )a___ is a complete binary tree such that each node in the tree contains a comparable object that us greater than or equal to th
    9·1 answer
  • How should you handle possible suicides:
    10·1 answer
  • Who are the four main antagonists in fnaf 1
    13·2 answers
  • When computing the cost of the basket of goods and services purchased by a typical consumer, which of the following changes from
    11·1 answer
  • In an income statement subtracting the cost of goods sold from the net sales provides the?
    11·1 answer
  • Electronic mail is a
    9·1 answer
  • How many sets of number do both Hex and RGB values have?
    10·1 answer
  • Write a program that reads a file that contains only integers, but some of the integers have embedded commas, as in 145,020. The
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!