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
A technician is working at a client's office after hours and needs two cables to finish the work but does not have immediate acc
svetlana [45]

Answer:

The following are the answers of the given scenario.

  • Crimper
  • Cable tester
  • Cable stri.pper

Explanation:

After hours, the specialist operates at that same customer's workplace as well as wants several wires to complete the job, although it would not provide direct links for pre-built wires. The wire required seems to be a dial-up link from the dial-up network to an original analog POTS port on a wall. Another wire would be to attach an Ethernet from the device to that of the current keystone port on that same wall.

Thus, Crimper, Cable Tester and Cable Stri.pper are the same equipment that the specialist needs to use to create the wires as well as then check whether these all operate correctly.

3 0
3 years ago
Copy the skeleton of code below into your answer. Then in the space indicated, add your own code to prompt the user for two numb
ahrayia [7]

Answer:

import java.util.*;

public class Main

{

public static void main(String[] args) {

    Scanner input = new Scanner(System.in);

   

 System.out.print("Enter the first: ");

 int first = input.nextInt();

 System.out.print("Enter the second: ");

 int second = input.nextInt();

 input.nextLine();

 System.out.print("Enter your name: ");

 String name = input.nextLine();

 

 int difference = Math.abs(second - first);

 

 System.out.println(name + ", the difference is " + difference);

}

}

Explanation:

*The code is in Java.

Create a Scanner object to get input from the user

Ask the user to enter the first, second, and name

Calculate the difference, subtract the second from the first and then get the absolute value of the result by using Math.abs() method

Print the name and the difference as in required format

7 0
3 years ago
Fill in the three blanks in the following statement. The longest movement in the Classical multi-movement cycle is the ______ mo
Tems11 [23]

Answer:

Fill in the three blanks in the following statement. The longest movement in the Classical multi-movement cycle is the <u>first</u> movement, and this movement is typically in a fast tempo and is in <u>sonata-allegro</u> form.

Explanation:

This topic is music. The first movement of a classical symphony is almost always fast.

Sonata-allegro form or first movement form is a musical structure consisting of three main sections: an exposition, a development, and a recapitulation. It has been performed widely since the early Classical period.

4 0
3 years ago
Name some of the file extensions for images and provide more information about one or two of them.
lidiya [134]
.png - ability to maintain a transparent background. good for logos.

.jpg - more common image format. used for general image rendering and also has a higher quality than the .png format.
7 0
3 years ago
If you click the Increase Font Size button too many times and make the font size too big, you can click the ____ button until th
bagirrra123 [75]

Answer:

Decrease Font Size.

Explanation:

If the font size becomes too big by repeatedly clicking too many times Increase Font Size.So to decrease the font size you should click on the decrease font size until the size becomes desirable. Decrease font size as the name suggests is used to decrease the size of the font.So the answer is Decrease font size.

3 0
3 years ago
Other questions:
  • You're trying to decide which disk technology to use on your new server. the server will be in heavy use around the clock every
    10·1 answer
  • An employee has contacted the IT Support call center where you work. They are complaining that they are unable to access any web
    14·1 answer
  • What device copies system files
    14·1 answer
  • Recursive Power Function Write a function that uses recursion to raise a number to a power. The function should accept two argum
    15·1 answer
  • You work in the educational software industry. Your boss asks you to give a brief lecture to other employees about the digital d
    7·2 answers
  • Amina question and any other )
    14·1 answer
  • Software for creating animations
    15·2 answers
  • Whay device is recommended to use to install windows 10
    13·1 answer
  • The data model shows the_______structrue of database.​
    14·1 answer
  • What kind of cable would you use to connect a network printer to the soho router if you were using a wired connection to the net
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!