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
wariber [46]
3 years ago
14

5.20 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. Ex: If the input is: 5 50 60 140 200 75 100 the output is: 50,60,75,
Computers and Technology
1 answer:
Sveta_85 [38]3 years ago
6 0

Answer:

Following are the code to the given question:

x= input()#defining a variable x that inputs value from the user-end

l = x.split(" ")#defining variable l that splits the x variable value with a space

t= int(l[len(l)- 1])#defining a variable t that decrease the l length and convert the value into integer

for i in range(1, (len(l) - 1)):#use for loop to calculate the range of the list

      if int(l[i]) < t:#defining if block that checks the list value is lessthan t

          print(l[i])#print list values

Output:

Please find the attached file.

Explanation:

In the above-given code, an "x" variable is declared that inputs the value from the user-end, and use the "l" variable that splits all the value and defined a "t" variable that adds value into the list and convert the value into an integer.

In the next step, for loop is declared that counts the lists and use a conditional statement that checks list value is less than t and use the print the method that prints the list values.  

You might be interested in
Write an expression that executes the loop body as long as the user enters a non-negative number. Note: If the submitted code ha
Mama L [17]

In the program While loop is used. In the while loop it divides the userNum by 2 in each iteration and prints the value of userNum. The inputs and corresponding outputs are written in the explanation.

<u>Explanation</u>:

In the while loop it divides the userNum by 2 in each iteration and prints the value of userNum.

import java.util.Scanner;  

public class NonNegativeLooper

public static void main (String [] args)

Scanner scnr = new Scanner(System.in);  

//initialize the userNum with 9

int userNum = 9;

//Repeat the loop until the userNum is not negative

while (userNum>=0)

System.out.println(Body);

//Prompt the user to enter the usrNum again

userNum = scnr.nextInt();

System.out.println(Done.);

return;

8 0
3 years ago
Which term collectively discribes hard disk ,CD,and flash drives​
mixer [17]

Answer:

The term memory collectively describes hard disk, CD and flash drive

Explanation:

4 0
3 years ago
Read 2 more answers
A customer calls complaining their laptop wont start what should I say
topjm [15]

Answer:

tell them to bring there laptop to you so you can explain how to get them out of situations like those. Or maybe do a video call so the person can show you whats going on and you can take it on from there guiding her on how to fix it...

Explanation:

4 0
2 years ago
When a class implements in interface, it must ________ Group of answer choices overload all of the methods listed in the interfa
Lilit [14]

Answer:

provide all of the nondefault methods that are listed in the interface, with the exact signatures and return types specified

Explanation:

I am assuming the programming language is Java. Actually, none of the answers are 100% correct, but this one is the only one that is partially correct. The reason is the class implementing an interface can be abstract, and in this case it may not provide ALL nondefault methods.

8 0
2 years ago
What are three things to consider in programming design?
balu736 [363]

Answer:

Data Structures and Algorithms, Source Control & Database and SQL

Explanation:

The above are the three things a starter should prepare his or her mind for.

6 0
3 years ago
Other questions:
  • 3) Write a program named Full_XmasTree using a nested for loop that will generate the exact output. This program MUST use (ONLY)
    6·1 answer
  • What is the chief ethical concern concerning all the new sources of data available through new technological means like internet
    9·1 answer
  • Write a method named showChar. The method should accept two arguments: a reference to a String object and an integer. The intege
    6·1 answer
  • Instructions:Select the correct answer from each drop-down menu. What type of font color should Kim select if she chooses a dark
    10·2 answers
  • Most computers and many mobile devices, such as smartphones and portable media players, can connect to which kind of network?
    11·1 answer
  • When processing all the elements of row i of a two-dimensional array named grades using a for loop with variable j, what is the
    13·1 answer
  • The data in RAM is saved when the computer is turned off. True or False
    8·1 answer
  • Describe FIVE distinct features of multi-threaded programming. Your answer should be language independent. g
    9·1 answer
  • A large gambling company needs to be able to accept high volumes of customer wagers within short timeframes for high-profile spo
    7·1 answer
  • The diagram shows the parts of a computer. In which part is data processing done?
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!