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]
2 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]2 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
How was kapilvastu named​
mixas84 [53]

Answer:  Kapilvastu was named after Vedic sage Kapilamuni

4 0
3 years ago
Holi alguien sabe como cambiar el gamertag en XBox App (para iOS)?
Schach [20]

Answer:

Hola, cambiar tu gamertag (el nombre o apodo que te identifica en los juegos de XBox en línea) es muy sencillo. Simplemente debes ingresar al menú principal de tu aplicación XBox App, y una vez allí seleccionar la imagen que te identifica como usuario. Al clickear allí, podrás seleccionar la opción Personalizar, donde se desplegará un menú de opciones dentro de las cuales se encontrará la de cambiar tu gamertag o nombre de usuario. Recuerda que solo podrás cambiar tu gamertag en forma gratuita una única vez.

3 0
2 years ago
What are smart mobile devices
Nezavi [6.7K]

portable computing tool

7 0
3 years ago
Which of the following is a hand-drawn animation that takes a large amount of time to complete?
elixir [45]

Answer:

Where are the choices?

Thanks for adding the choices at the comment secion

  1. 2D animation
  2. 3D animation
  3. Stop Motion  
  4. Celluloid animation

A- Celluloid Animation

4 0
2 years ago
What is the function of a header when writing HTML
marusya05 [52]
The Function of a header is that it makes your TEXT LOOK BIGGER

5 0
3 years ago
Other questions:
  • Which of the following can you NOT apply for at any FLHSMV office? A. Certificate of title B. License plates C. Vehicle registra
    15·2 answers
  • Due to the internal style sheets of some browsers, your website may look different to someone who is using firefox as opposed to
    11·1 answer
  • Suppose your parents are planning to take you
    8·1 answer
  • What is the purpose of the overload keyword in the ip nat inside source list 1 pool nat_pool overload command?
    8·1 answer
  • 2. What is the layout of the modern keyboard known as?
    13·1 answer
  • Which of these is a Microsoft certification for system engineers?
    9·1 answer
  • Which network component blocks status?
    9·1 answer
  • I live in Alabama and I’m ab to leave to go on a 3 week trip to France and I’m wondering how I can get LTE for my IPhone 6s Plus
    15·2 answers
  • The objective of this task is to use Scapy to estimate the distance, in terms of number of routers, between your VM and a select
    7·2 answers
  • What is a trusted computing base (TCB)? Hosts on your network that support secure transmissions The operating system kernel and
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!