Computers and Technology
Computers and Technology, 25.11.2021 06:00, terry94

Overview Practice using loops, lists, and user-defined functions.
Objectives
Use critical thinking skills to determine how to manipulate lists with a user-defined function and loops. You will be able to practice creating functions, returning values, and using lists with loops.
Description
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, read in those integers. Finally, get the last value from the input, and output all integers less than or equal to that value.
Ex: If the input is:
Enter the number of integers in your list: 5
Enter the 5 Integers:
50
60
140
200
75
Enter the threshold value:
100
the output is
The integers that are less than or equal to 100 are:
50
60
75
The integers that are less than or equal to 100 are:
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
Such functionality is common on sites like Amazon, where a user can filter results.
Your code must define and call the following function:
def output_ints_less_than_or_equal_to_t hreshold(user_values_list, upper_threshold) returns a list of integers from user_values_list that are less than or equal to upper_threshold
Recall that functions may return a value. In the code you created for previous assignments and examples, you retumad one number that was either an integer or a font. You can actually return anything from a function in the same manner. For this lab, you will be returning a list of integers from your user-defined function.
Likewise, you can pass anything to a function, not just numbers and strings. For this lab, you will have to pass a list to your function.
LAB 100 Output values in a list below a user defined amount functions
1 # Define your function here
2
3 if --nane-- '-noin-' :
4
5 #Start the rest of your code here
6

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 00:30, bargasdevon123
To insert a column without using commands in any tabs, a user can -click and then click insert column.
Answers: 3
image
Computers and Technology, 22.06.2019 07:20, Hcalhoun21
Write a pseudocode solution for each of these problems. 1. design a while loop that lets that user enter a number. the number should be multiplied by 10, and the result stored in a variable named product. the loop should iterate as long as product contains a value less than 100. 2. design a do-while loop that asks the user to enter two numbers. the numbers should be added and the sum displayed. the loop should ask the user whether he or she wishes to perform the operation again. if so, the loop should repeat; otherwise it should terminate. 3. design a for loop that displays the following set of numbers: 0, 10, 20, 30, 40, 50 100. 4. design a nested loop that displays 10 rows of # characters. there should be 15 # characters in each row. 5. convert this for loop to a while loop. declare integer count for count = 1 to 50 display count end for 6. find the error in the following pseudocode. declare boolean finished = false declare integer value, cube while not finished display “enter a value to be cubed.” input value; set cube = value ^ 3 display value, “ cubed is “, cube end while
Answers: 2
image
Computers and Technology, 23.06.2019 20:10, banna01man
Leo is a recruitment executive for a large company. he has identified new labor resource requirements in both the marketing and production departments. what should be his first step in recruiting candidates for the positions? a. conduct background checks of candidates b. make job offers c. arrange interviews d. conduct reference checks e. place job ads on job sites
Answers: 1
image
Computers and Technology, 24.06.2019 00:30, louie8656
Match the sentence fragment in the first column with the appropriate ending in the second column. a little per favore?
Answers: 1
Do you know the correct answer?
Overview Practice using loops, lists, and user-defined functions.
Objectives
Use cri...

Questions in other subjects:

Konu
Mathematics, 11.02.2021 01:20