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
Please help me very important
3241004551 [841]

Answer:

C, Or D.

Explanation:

<em>Because A speed enhancing hard drive Can store any type of quick file if you just click on it will load fast. Same thing goes for a hard drive but you have to transfer the file</em>

4 0
2 years ago
Which of the following protects against cave-ins? A. All answer choices protect against cave-ins B. Shielding C. Shoring D. Slop
babunello [35]
I think it is b idk if it is 100% right
4 0
3 years ago
Read 2 more answers
What's the difference between help desk and service desk?
Mekhanik [1.2K]

Answer:

A help desk is considered to be focused on break-fix (like a incident management), where a service desk is there to assist with break-fix and with service requests (requests for new services) and requests for information (ex. “how do I do <u>X</u>?”).

Hope this helps!

3 0
2 years ago
6. Which is not considered a storage device a. USB Flash Drive b. External hard Drive c. MS-Windows d. Internal Hard Drive e. Me
Lana71 [14]

Answer:

MS-Windows

Explanation:

MS-Windows is an operating system not a storage device.

6 0
3 years ago
An attacker on the network intends to overwhelm another computer with icmp packets as follows:
Blizzard [7]
And, the simple answer is to disable ICMP echo requests on either the router or Workstation.
4 0
3 years ago
Other questions:
  • Operating system software allows you to use your fingers, a mouse or other pointing device to select screen controls, such as bu
    5·2 answers
  • Write a Python function called validateCreditCard that takes 8-digit credit card number as the input parameter (string value) an
    8·1 answer
  • 4. How can you select non-adjacent cells (i.e. cells that are not all together in one block)?
    5·2 answers
  • While using the CLI on a Windows 10 64-bit computer with a single HDD and a single volume, you want to move from the current dir
    15·1 answer
  • Explain the importance of determinism in an industrial LAN
    8·1 answer
  • Describe the different
    12·1 answer
  • 8.11 LAB: Count characters - functions Write a program whose input is a character and a string, and whose output indicates the n
    6·1 answer
  • Write the definition of a class Phone containing: 1. A data member named model of type string. 2. A data member named partNumber
    11·1 answer
  • What is meant by byte in computer terminology​
    6·2 answers
  • ( BRAINLIEST) <br> Name 2 input devices and 2 output devices on a smart phone.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!