Write a PYTHON program that first gets integers from user input. The input begins with a threshold value. Then, later subsequent user input values are added to a list until -1 is entered. Finally, output all integers less than or equal to the threshold value.
Write a PYTHON program that first gets integers from user input. The input begins with a threshold value. Then, later subsequent user input values are added to a list until -1 is entered. Finally, output all integers less than or equal to the threshold value.
Example : If the input is:
100
50
60
140
200
75
-1
The output should be:
50
60
75
The 100 specifies that the program should output all integers less than or equal to 100. Next, five integers are added to the list: 50, 60, 140, 200, and 75. Finally, -1 indicates the end of the list.
Write your code to define and use two functions:
get_user_values(nums)
output_ints_less_than_or_equal_to_threshold(nums, threshold)
STARTER CODE (in photo)
![main.py
1 # Define your get_user_values function here
2
3
4 # Define your output_ints_less_than_or_equal_to_threshold function here
6
7 if _name_
threshold = int(input())
'_main_':
8
nums =
10
11
get_user_values(nums)
output_ints_less_than_or_equal_to_threshold(nums, threshold)
12](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F47bcd2e2-fd09-4d16-8209-9beee0b05010%2F547b9630-4496-46a4-93b1-ac857007dee5%2Fnoa7ne_processed.png&w=3840&q=75)
![](/static/compass_v2/shared-icons/check-mark.png)
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)
![C++ for Engineers and Scientists](https://www.bartleby.com/isbn_cover_images/9781133187844/9781133187844_smallCoverImage.gif)