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
torisob [31]
3 years ago
6

Ask the user to enter the number of elements in a list of numbers. Take in the numbers from the user and then output the list th

e user entered . Followed by the list the user entered with only the 2nd half sorted. NOTE: You may assume the user will enter a list with an even number of elements. You should sort only the 2nd half the first half is to remain as is.

Computers and Technology
1 answer:
m_a_m_a [10]3 years ago
4 0

Answer:

#Section 1

   lst= []

   lstNo=int(input("Enter even number of elements in List: "))

   for i in range(0, lstNo):

       pr=int(input(": " ))

       lst.append(pr)

   print(lst)

#Section 2

   nlst=[]

   dlst=[]

   n =len(lst)

   i=0

   while (i < n/2):

       nlst.append(lst[i])

       i = i+1

   j = n-1

   while j >= n/2:

       dlst.append(lst[j])

       j = j-1

   dlst.sort()

   for a in range(len(dlst)):

       nlst.append(dlst[a])

   print(nlst)

       

Explanation:

#section 1:

An empty list is declared to hold the list inputs by the user <em>lst= [] </em>

The program then prompts the user to enter an even number of elements that will be contained in the list.

The for loop is used to iterate from zero(0) to the number of elements stated, in order to get the input that is appended to the list.

lastly, the list is printed out.

#Section 2:

In this section two new lists are created to hold one half of the value respectively.

The first list collects the first half of the list using a while loop and stores it, it does not perform any sorting on it.

The second list collects the second half using a while loop and sorts the list using the<em> .sort()  </em>method which arranges elements in an ascending order.

Finally, the second list that has been sorted is added to the first and the result is printed to the screen.

A picture of how the code will run has been attached.

 

You might be interested in
Which is true of ASCII and Unicode?
allochka39001 [22]

Answer:

The correct options is;

Every character written in A S C I I can be represented using Unicode

Explanation:

All characters found in A S C I I can be found in Unicode such that A S C I I is a subset of Unicode whereby the meaning of the numbers from 0 to 127 are the same in both A S C I I and Unicode

The size of the A S C I I character in 8-bit A S C I I encoding is 8 bits while a Unicode U T F - 8 encoding has between 8 bits (1 byte) and 32 bits (4-bytes)

A S C I I assigns only 127 of the 255 possible numbers that can be stored in an 8-bits character, where the spare characters are then used by P C s for accented characters, therefore, it A S C I I does not define accented characters

4 0
2 years ago
Fill in the blank: the final step of the dhcp discovery process is known as ______. Multiple choice, shuffle.
Ugo [173]

The configuration procedure moves into its final stage once the DHCP server has received the DHCPREQUEST message from the client. An acknowledgement packet, or DHCPACK, is sent to the client at this step.

<h3>What final step of the DHCP discovery process?</h3>

After selecting the proper IP address, the server sends the client an OFFER packet, and the client replies with a REQUEST packet. The process ends with the server sending an ACK packet to confirm that the client has received an IP address.

Therefore, DHCP may dynamically issue IP addresses to any Internet-connected device, node, or client computer.

Learn more about DHCP here:

brainly.com/question/28150867

#SPJ1

6 0
1 year ago
C++
Lilit [14]
The awnser is task 6 because 6 plus 8 is 20 and that equals for 6 gallons to go the the teen choice awards
7 0
3 years ago
What frequency band is used by bluetooth, 802.11b, and 802.11g?
bagirrra123 [75]
802.11 is a Wi-Fi standard, not a frequency, both of those operate at 2.4 GHz. Bluetooth operates at frequencies between 2402 and 2480 MHz, or 2400 and 2483.5 MHz. 
4 0
2 years ago
I need help with this plz! It’s for a test and I really need help
Bas_tet [7]

Answer:

c

Explanation:

assuming you are coding in python and have not install any calculation codes, the answer is most likely c

4 0
3 years ago
Other questions:
  • If you purchase a software suite for personal use, you can install the software how many times on how many different machines?
    6·1 answer
  • 1. Caches are important to providing a high-performance memory hierarchy to processors. Below is a list of 32-bit memory address
    7·1 answer
  • Which of these are forms of data? Check all that apply.
    8·2 answers
  • Intranets:
    8·1 answer
  • Which is the OS that can be obtained for free or at a much lower price than other major operating systems?
    15·2 answers
  • Describe the major elements and issues with system prototyping​
    7·1 answer
  • Answer This One Question Right For Brainliest
    10·1 answer
  • Explain how mobile phone production could be more sustainable​
    8·2 answers
  • Select the correct answer.
    6·1 answer
  • Why are my texts green when texting another iphone.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!