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
Kipish [7]
2 years 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:
qaws [65]2 years ago
7 0

Answer:

def output_ints_less_than_or_equal_to_threshold(user_values, upper_threshold):

 for value in user_values:

     if value < upper_threshold:

         print(value)  

def get_user_values():

 n = int(input())

 lst = []

 for i in range(n):

     lst.append(int(input()))

 return lst  

if __name__ == '__main__':

 userValues = get_user_values()

 upperThreshold = int(input())

 output_ints_less_than_or_equal_to_threshold(userValues, upperThreshold)

Explanation:

IgorC [24]2 years ago
5 0

Answer:

# the terminal display waiting for the user to enter the input

# the received input is assigned to user_input

user_input = input()

# the user_input is splitted based on space and is assigned to integerlist

integerlist = user_input.split(" ")

# the last element in the integerlist is assigned as threshold

threshold = int(integerlist[len(integerlist) - 1])

# a for loop that loop from index 1 to second to the last element in the list

# the loop compare each element with the threshold

# if element is less than threshold, it is displayed

# the loop start from index 1 because index 0 represent number of element

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

       if int(integerlist[i]) < threshold:

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

Explanation:

The program is written in Python and well commented.

An sample of program output when it is executed is attached.

You might be interested in
Which of the following is a true statement about cloud computing?
Veseljchak [2.6K]

Answer:

There are additional security risks associated with using cloud computing over local data storage.                    

Explanation:

Cloud computing: The term "cloud computing" is described as a process through which an individual tends to access and store various programs and data over the internet rather than his or her computers' "hard drive". However, the term "cloud" here refers to a specific metaphor associated with the internet.

Types:

1. Software-as-a-service or SaaS.

2. Platform-as-a-service or PaaS.

3. Infrastructure-as-a-service or IaaS.

In the question above, the very first option is correct as all other options mentioned over here are incorrect because they aren't related to cloud computing.

3 0
1 year ago
Peter accumulated many photos from his visit to Wisconsin. He wants to upload these photos to a social networking site. Which fi
daser333 [38]

Answer:

JPG / JPEG best choice and work well on websites

Explanation:

JPEGs contains millions of colors, so this type of file is ideal for photographs.

Best choice for posting on social media channels

7 0
2 years ago
What does a sticky CTA do?
Anarel [89]
It encourages users to revisit your website.
5 0
1 year ago
Read 2 more answers
FOREACH, EXPLODE and MAIL are examples of crazy functions.
jenyasd209 [6]
The answer would be B
4 0
2 years ago
Here is a super challenge for you if you feel up for it. (You will need to work this out in Excel.) In 2017 the Islamic month of
Ann [662]

Answer:

7/73

Explanation:

May has 31 days. 31 - 26 = 5. So there are 5 more days to the next month (June). June has 30 days. So Muslims fasted 35 days in total. 2017 had 365 days. 365 - 35 = 330 days were spent not fasting. So the fraction is 35/365. This fraction simplified would be 7/73.

4 0
2 years ago
Other questions:
  • An mp3 takes up about 16 kilobytes of memory per second of music. if you owned a one terabyte hard drive and filled it with only
    15·1 answer
  • In defining security implemention, what are the roles of the following committees. 1) gateway committee 2) project committee 3)
    8·1 answer
  • Delete Prussia from country_capital. Sample output with input: 'Spain:Madrid,Togo:Lome,Prussia: Konigsberg' Prussia deleted? Yes
    13·1 answer
  • When a program has several modules calling other modules, programmers often use a program ____, which operates similarly to an o
    5·1 answer
  • Consider the following 3-PARTITION problem. Given integers a1; : : : ; an, we want to determine whether it is possible to partit
    10·1 answer
  • PLEASE HELP PROGRAMMING WILL GIVE BRAINLIEST
    6·1 answer
  • Complete the program below that takes in one positive, odd, integer, n (at least 3), and prints a "diamond" shape of stars with
    9·1 answer
  • Suggest how the following requirements might be rewritten in a quantitative way. You may use any metrics you like to express the
    7·1 answer
  • Write a program that calculates taxi fare at a rate of $1.50 per mile. Your pro-gram should interact with the user in this manne
    12·1 answer
  • The most likely reason a firm would decide to establish an extranet would be the desire to Multiple Choice speed the flow of inf
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!