answer.
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
lord
2 months ago
9

5.15 LAB: Output values below an amount Write a program that first gets a list of integers from input. The input begins with an

integer indicating the number of integers that follow. Then, get the last value from the input, which indicates a threshold. Output all integers less than or equal to that last threshold value. Assume that the list will always contain fewer than 20 integers. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50 60 75 The 5 indicates that there are five integers in the list, namely 50, 60, 140, 200, and 75. The 100 indicates that the program should output all integers less than or equal to 100, so the program outputs 50, 60, and 75.

Computers and Technology
2 answers:
Harlamova29_29 [1K]2 months ago
7 0

Response:

def print_ints_below_or_equal_to_limit(values, limit):

  for num in values:

    if num <= limit:

        print(num)

def retrieve_user_inputs():

  count = int(input())

  numbers = []

  for j in range(count):

    numbers.append(int(input()))

  return numbers

if __name__ == '__main__':

  inputs = retrieve_user_inputs()

  threshold = int(input())

  print_ints_below_or_equal_to_limit(inputs, threshold)

Clarification:

zubka84 [1K]2 months ago
5 0

Answer:

# The terminal will wait for user input

# The input entered by the user is assigned to user_input

user_input = input()

# The user's input is split by spaces and stored in integerlist

integerlist = user_input.split(" ")

# The last entry in integerlist is saved as threshold

threshold = int(integerlist[-1])

# A for loop will iterate from index 1 to the second to last element in the list

# Each element is compared against the threshold

# Elements less than the threshold will be printed out

# The loop begins at index 1 because index 0 represents the number of elements

for i in range(1, len(integerlist) - 1):

   if int(integerlist[i]) < threshold:

       print(integerlist[i], sep="")

Explanation:

The code provided is written in Python and includes adequate comments explaining its functionality.

Moreover, a sample output of the program upon execution is included.

You might be interested in
Explain working principle of computer?​
maria [1035]

Answer:

The principle behind how computer systems operate involves a primary machine-based function that remains invisible to us, serving as a control center that changes the input data into output. This central element known as the central processing unit (CPU) illustrates that the operation of computers is quite intricate.

Explanation:

5 0
3 months ago
Explain how abstraction is used in a GPS system
ivann1987 [1066]

Answer

Abstraction in GPS technology allows the system to use clearly defined interfaces while enabling the integration of additional, more complex functionalities.

Explanation

The GPS system employs abstraction to organize layers of complexity for user interaction. It connects satellite-based positioning and timing systems to enable a radio receiver to acquire signals across four dimensions—latitude, longitude, altitude, and time—after synchronizing this data.


7 0
3 months ago
Read 2 more answers
You want to register the domain name ABCcompany.org, but the registration service is not allowing you to do that. What's the mos
amid [951]

Options :

The domain name is already taken.

Domain names are required to end with ".com".

You do not hold legal ownership of ABC Company.

Domain names must exclusively use lowercase letters.

Answer:

The domain name is already taken.

Explanation: In the above scenario, ABCcompany.org signifies the domain associated with a specific individual or organization that leads to the owner's website. Each domain name must be unique; therefore, no two different entities or individuals can have identical domain names. Domains can have endings like .com, .org, .ng, and more, and they are not case-sensitive. Thus, the inability to register the mentioned domain is probably because it has already been claimed by someone else.

6 0
3 months ago
Assume that you are testing the Orders database introduced in Watt (2014) - Appendix C. Discuss the problems and possible conseq
ivann1987 [1066]

Answer:

129 \frac{2}{?} 23.4. \div 164 \times 5y1 +. \\.00487ggh

6 0
2 months ago
Which of the following is an object such as a field which can be inserted into a document
amid [951]

Response:

SORRY, but you need to ask a different question.

Reasoning:

since you didn't provide a complete question with options...

I can't assist with this one.

8 0
1 month ago
Other questions:
  • In what areas is Leslie's underspending hurting her budget select all that apply
    5·1 answer
  • Start with the following Python code. alphabet = "abcdefghijklmnopqrstuvwxyz" test_dups = ["zzz","dog","bookkeeper","subdermatog
    13·1 answer
  • Light travels at 3 × 108 meters per second. A light-year is the distance a light beam travels in one year.Write a PYTHON program
    14·1 answer
  • Consider the following skeletal C program: void fun1(void); /* prototype */ void fun2(void); /* prototype */ void fun3(void); /*
    11·1 answer
  • Write a program that reads an unspecified number of integers, determines how many positive and negative values have been read, a
    10·1 answer
  • Describe a situation involving making a copy of a computer program or an entertainment file of some sort for which you think it
    7·1 answer
  • Write lines of verse that rhyme to remember the following information:
    16·2 answers
  • During which stage does the central processing unit analyze the instruction and encode it in the form of a number, and then gene
    12·1 answer
  • "If someone really wants to get at the information, it is not difficult if they can gain physical access to the computer or hard
    11·1 answer
  • When using preventative insecticides which holiday period should trigger an application?
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!