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]
3 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]3 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
Sophia's plays her favorite game on her phone, where the game uses the phone's
nirvana33 [79]

Answer:

Augmented Reality

Explanation:

Augmented reality is a camera to overlay images on real-world scenery. Basically what the Pokemon GO app does.

8 0
1 year ago
Which employees work directly with customers, helping them make deposits and withdrawals?
d1i1m1o1n [39]
I believe the answer is customer service
5 0
3 years ago
Read 2 more answers
A(n) __________ port, also known as a monitoring port, is a specially configured connection on a network device that is capable
drek231 [11]

Answer:

The answer is "SPAN"

Explanation:

The full form of SPAN port is  "Switch Port Analyzer", which is used to designed specifically for the interface on a network device, that would be able to monitor all traffic passing across the entire device.

  • The use of this port will also call the mirror ports, that is a popular way of gathering data traffic for tracking purposes.
  • It is primarily used to access the bus switch and all interfaces, which is usually accessible from data transmission.
7 0
4 years ago
Write a statement that calls the recursive method backwardsAlphabet() with parameter startingLetter.
lakkis [162]

Answer:

Following are the code to method calling

backwardsAlphabet(startingLetter); //calling method backwardsAlphabet

Output:

please find the attachment.

Explanation:

Working of program:

  • In the given java code, a class "RecursiveCalls" is declared, inside the class, a method that is "backwardsAlphabet" is defined, this method accepts a char parameter that is "currLetter".
  • In this method a conditional statement is used, if the block it will check input parameter value is 'a', then it will print value, otherwise, it will go to else section in this block it will use the recursive function that prints it's before value.
  • In the main method, first, we create the scanner class object then defined a char variable "startingLetter", in this we input from the user and pass its value into the method that is "backwardsAlphabet".

3 0
4 years ago
What is Aggregate Demand equivalent to?<br><br> A. Real Output<br> B. Nominal GDP<br> C. Inflation
nirvana33 [79]
<span>What is Aggregate Demand equivalent to?

A. Real Output</span>
6 0
4 years ago
Other questions:
  • When does a kernel panic occur?
    12·2 answers
  • If you turn your volume to loud on u'r headphones can it break the sound quality of the speaker?
    9·2 answers
  • Write an application program that creates and prints a random phone number of the form XXX-XXX-XXXX. Include the dashes in the o
    5·1 answer
  • Which of the following phrases describes top-down processing
    8·1 answer
  • Which one of the following oscilloscope controls is used to move the trace up and down the screen vertically
    14·1 answer
  • If you feel that an OSHA inspection is needed to get hazards corrected at your workplace, which is your best option?
    7·1 answer
  • What does it mean to “declare a variable”? create a variable use a variable share a variable modify a variable
    11·2 answers
  • Write a method called sum with a while loop that adds up all numbers between two numbers a and b. The values for a and b can be
    11·2 answers
  • Fill in the blank with the correct response.
    10·1 answer
  • How do you record your own video game Music and post Them on yt
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!