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
BlackZzzverrR [31]
2 years ago
13

write a python function that takes the largest and smallest numbers in a list, and swap them (without using min() or max() )

Computers and Technology
1 answer:
Akimi4 [234]2 years ago
8 0

Answer:

def SwapMinMax ( myList ):

   myList.sort()

   myList[0], myList[len(myList)-1] = myList[len(myList)-1], myList[0]

   return myList

   

Explanation:

By sorting the list, you ensure the smallest element will be in the initial position in the list and the largest element will be in the final position of the list.

Using the len method on the list, we can get the length of the list, and we need to subtract 1 to get the maximum element index of the list.  Then we simply swap index 0 and the maximum index of the list.

Finally, we return the new sorted list that has swapped the positions of the lowest and highest element values.

Cheers.

You might be interested in
((11111111-1011100) X (10100 / 10))- ( 110010000+ 1110011)
dsp73

Answer:

10089891099

Explanation:

?

3 0
2 years ago
What type of machine is the energy of a seismic wave recorded?
Sloan [31]
<span>the answer is most likely "Seismograph"</span>
7 0
3 years ago
Can someone please tell me how to download tor browser onto a Linux laptop?
marta [7]

Answer:

Use windows

Explanation:

7 0
2 years ago
When you code a column list in an INSERT statement, you can omit columns with default values and columns that allow ____________
stiks02 [169]

Answer:

NULL is the correct answer of this question.

Explanation:

The insert statement is used for inserting a column list into the database this statement is an under Data Manipulation language.When we insert any column into the database there is always a null value stored.

  • Insert statement is used to insert the data into the database .
  • To insert data following syntax is used:-

         insert into tablename (column data type).

  • When we insert any data into the database the default value is stored is bull.
6 0
3 years ago
¿Como viaja la información? en la tecnologia
Simora [160]

Answer:

Todavía estoy aprendiendo español, por lo que las palabras podrían estar mal de alguna manera.

Explanation:

El seguimiento de vuelos, las agencias de viajes en línea y el uso de las redes sociales en línea son todas formas de tecnología de viajes que pueden ayudar a las personas a planificar viajes. La tecnología de viajes incluye sistemas de reserva por computadora, así como aplicaciones mucho más amplias que son cada vez más importantes.

6 0
3 years ago
Read 2 more answers
Other questions:
  • A​ _______ helps us understand the nature of the distribution of a data set.
    10·1 answer
  • a corporation needs an operating system that allows the various teams in its office to network &amp; collaborate on projects. wh
    11·2 answers
  • General equation: y = (89 / 27) - z * x + a / (a % 2) (recall: a is an integer; the 89 and 27 constants in the equation should b
    14·1 answer
  • Write a SELECT statement that returns three columns: EmailAddress, OrderID, and the order total for each customer. To do this, y
    14·1 answer
  • I NEED HELP ASAP
    8·1 answer
  • Binary numbers are based on __________.
    12·2 answers
  • Why do we need the system requirements for Adobe photoshop?
    14·1 answer
  • (Java) Write a program that accepts a number of minutes and converts it both to hours and days. For example, 6000 minutes is 100
    10·1 answer
  • Kevin would like to ensure that his software runs on a platform that is able to expand and contract as needs change. Which one o
    6·1 answer
  • You are configuring a network attached storage (nas) appliance. what file sharing protocol(s) could you use to allow access to w
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!