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
Does anyone know how to write this right? This is for a coding class and I’m super confused on it.
vovangra [49]

Answer:

This is using c++ syntax, you might need to make slight adjustment for other languages.

First activity:

string firstSnack = "chips";

string secondSnack = "pizza";

string thirdSnack = "apples";

string bestSnack =  firstSnack;

bestSnack = secondSnack;

Second activity:

double apple = 0.5;

double banana = 0.75;

double orange = 1.43;

double total = apple + banana + orange;

Explanation:

When first declaring a variable, you want to specify the type (such as int, double, string, bool, etc.) and then the name. You can set the variable value in the declaration, or you can set it to a value later in the program by not having the equals sign and whatever comes next.

4 0
2 years ago
Hypertext enables you to navigate through pieces of information by clicking the __________, that connect them.
Nana76 [90]

What we usually click to open the hypertext is called; Hyperlinks.

<h3>What is hypertext?</h3>

Hypertext is defined as a form of writing with three characteristics namely;

  • Discernable free standing content nodes.
  • Links between nodes.
  • The expectation of active choice by readers.

Now, a hyperlink is one that points to a whole document or to a specific element within a document. Hypertext is simply text with hyperlinks which we click to view the hypertext.

Read more about Hypertext at; brainly.com/question/853165

#SPJ1

5 0
3 years ago
Which protocol is often used in conjunction with ipsec to provide a remote access client vpn with user authentication?
amid [387]

The L2TP or Layer 2 Tunneling Protocol is often used in conjunction with ipsec to provide a remote access client vpn with user authentication.

<h3>What is vpn?</h3>

VPN is known as a Virtual Private Network extends a private network across a public network and activates users to send and receive data across shared or public networks as if their computing devices were directly connected to the private network.

The main difference between VPN proxy and a VPN is encryption and VPNs hides all the web activities performed by the user as well as user's private IP address.

Therefore, the L2TP or Layer 2 Tunneling Protocol is often used in conjunction with ipsec to provide a remote access client vpn with user authentication.

Learn more about VPN here:

brainly.com/question/17272592

#SPJ4

3 0
2 years ago
What are the careers needed to create a video game? Name all the careers involved please.
AURORKA [14]
Audio Engineers
Interpreters and Translators
Video Game Testers
Technical Support Specialists
Marketing Managers
Market Research Analysts
Sales Representatives

6 0
3 years ago
PLEASE ANSWER QUICK
butalik [34]

Answer: C

Explanation:

8 0
3 years ago
Read 2 more answers
Other questions:
  • An administrator working on a Windows Server 2016 Server Core installation needs to disable DHCP on all interfaces on the server
    12·1 answer
  • How many service packs did windows 7 have?
    9·1 answer
  • Thomas is using a drawing program to complete a construction. Which construction could he be completing? (5 points).
    5·2 answers
  • What does nat stand for? network access trigger network administration timetable network address translation network association
    13·1 answer
  • Două numere a și b sunt numite generatoare ale unui număr natural n dacă a∙b+[a/b]=n, unde s-a notat cu [c] partea întreagă a nu
    7·1 answer
  • What is the advantage of using a high-level language over machine language for writing computer programs?
    15·2 answers
  • Write a script that will read from a file x and y data points in thefollowing format:
    9·1 answer
  • What happen if file server stops working?
    5·1 answer
  • Complete the program below named CountVowels so that it reads in a string, counts all the vowels in that string, and prints out
    13·1 answer
  • To generate a series of first ten counting number of algorithm​
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!