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
Brainstorm what you want your LED board to do. What would need to happen first? What happens next?
lbvjy [14]
First it will glow then change what color you want
5 0
3 years ago
Read 2 more answers
In cell I5, enter a formula to calculate the total admission fees collected for the 2018
V125BC [204]
The formula is to calculate the total admission fees collected is = F5*B14

1. Click on cell I5
2. Type equal sign =
3. Type F5 or click on F5 cell
3. Type multiplication sign *
4. Type B14 or click on B14 cell
4 0
3 years ago
Read 2 more answers
“The software crisis is aggravated by the progress in hardware technology?” Explain with examples
exis [7]

Answer:

Basically, dealing with the "software crisis" is what we now call software engineering. We just see the field more clearly now.

What this crisis was all about is that in the early days of the modern technological era -- in the 1950s, say -- there was tremendous optimism about the effect that digital computers could have on society, on their ability to literally solve humanity's problems. We just needed to formalize important questions and let our hulking "digital brains" come up with the answers.

Artificial intelligence, for example, had some early successes in easy to formalize domains like chess and these sorts of successes led to lots of people who should have known better making extremely naive predictions about how soon perfect machine translation would transform human interaction and how soon rote and onerous work would be relegated to the dustbin of history by autonomous intelligent machines.

7 0
2 years ago
Write measure five safety measures can be taken to stay safe in social media​
alexdok [17]

Answer:

  1. <u>Use a strong password</u>.
  2. <u>Use a different password for each of your social media accounts</u>.
  3. <u>Set up your security answers. </u>
  4. <u>If you have social media apps on your phone, be sure to password protect your device.</u>
  5. <u>Be selective with friend requests. </u>

5 0
2 years ago
Read 2 more answers
While the economy of eastern Washington relies on farming, western Washington relies on technology.
Strike441 [17]
True- western Washington hosts modern technologies supporting both academic and co curricular activities
3 0
3 years ago
Read 2 more answers
Other questions:
  • Scratch and grinding marks on sedimentary rocks indicate which type of environment?
    6·1 answer
  • LargeCo is planning a new promotion in Alabama (AL) and wants to know about the largest purchases made by customers in that stat
    7·1 answer
  • Did this technological advancement take away or create jobs? Overall, what was the contribution of this technological advancemen
    12·1 answer
  • HELP 11 pointsw to the person who helps me
    11·2 answers
  • You open a folder Properties box to encrypt the folder, click Advanced, and discover that Encrypt contents to secure data is dim
    10·1 answer
  • Look at the four schematic symbols shown in the figure above. Each of the symbols is labeled with a number. Which of the followi
    11·1 answer
  • 4. What is an example of a Trans receiver? *<br> A. Pager<br> B. Wi-Fi<br> C. Telephone
    14·1 answer
  • There are several design goals in building an operating system; for example, resource utilization, timeliness, robustness and so
    11·1 answer
  • Blockchain is often associated with Bitcoin and the financial services industry. However, it is applicable to almost every indus
    13·1 answer
  • This question involves the creation and use of a spinner to generate random numbers in a game. a gamespinner object represents a
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!