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
netineya [11]
3 years ago
12

Given a sorted list of integers, output the middle integer. A negative number indicates the end of the input (the negative numbe

r is not a part of the sorted list). Assume the number of integers is always odd. Ex: If the input is:
Computers and Technology
1 answer:
masya89 [10]3 years ago
8 0

Answer:

The program in Python is as follows:

myList = []

num = int(input())

count = 0

while num>=0:

   myList.append(num)

   count+=1

   num = int(input())

myList.sort()

mid = int((count-1)/2)

print(myList[mid])

Explanation:

This initializes the list

myList = []

This gets the first input

num = int(input())

This initializes count to 0

count = 0

The following is repeated until the user inputs a negative number

while num>=0:

This appends the input number to the list

   myList.append(num)

This increments count by 1

   count+=1

This gets another input

   num = int(input())

This sorts the list

myList.sort()

Assume the number of inputs is odd, the middle element is calculated as

mid = int((count-1)/2)

This prints the middle element

print(myList[mid])

<em>From the complete question. the condition that ends the loop is a negative integer input</em>

You might be interested in
Which two keys on the keyboard allow an access user to move the insertion point to the next field to the right in datasheet view
Mashcka [7]
Hey there!

In Microsoft Access, you can click the Tab key then the Enter key on your keyboard to establish a new insertion point directly to the right of your current insertion point when entering data in datasheet view. 

Hope this helped you out! :-)
4 0
3 years ago
In terms of system thinking, what is process?
Talja [164]

Answer:b) The computer program that processes the data.

Explanation: In the computer system , process is the part of computer program which are responsible for performing of the processing of the data and other functions .The working of the process is associated with the program code and related activities/functions.

Other options that are mentioned in the question are incorrect because they don't describe the process correctly .Thus , the correct answer is option (b).

5 0
3 years ago
Read 2 more answers
Which of the following statements correctly describe a computer program?
Naddik [55]

Answer: A. It’s a robust way to find information

Explanation:

Hope this help.

3 0
3 years ago
Read 2 more answers
Types of email resources. Examples
denis23 [38]
Newsletter emails
Milestone emails
Welcome emails
Review request emails

Hope this helps!
8 0
3 years ago
When do you use a for loop?
AleksandrR [38]

Answer:

You use a for loop when you know how many times you want to run the loop

Explanation:

if you dont know, use a while loop

6 0
2 years ago
Read 2 more answers
Other questions:
  • Yesterday Hunter's laptop screen appeared to go black. The laptop was still running, but he could not see the desktop or any gra
    9·1 answer
  • What will happen with communication methods in five years?
    8·1 answer
  • What is the main role of LDAP?
    14·1 answer
  • 1| def saveUserProfile(firstName, lastName, age, height, country):
    7·1 answer
  • Service that connects on-premises software appliances with cloud based storage is ______
    10·1 answer
  • PLS HELP QUICKLY!!!<br> Thank you
    7·2 answers
  • Any kind of brances in science
    13·1 answer
  • Cloud suites are stored on your hard drive and are available anywhere you can access the Internet
    15·1 answer
  • What is the correct name for the words Home, Insert, Design, Layout, References, etc. in the ribbon in Word 2016?
    7·1 answer
  • Why would you browse by entering a URL rather than use a link in a Web page
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!