5.18 LAB: Smallest and largest numbers in a list Instructor note: Feel free to use Python's built-in min() and max() functions to solve this. The heart of this lab is the first part: constructing a list of values from user-entered input. Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smallest and largest integers in the list. Ex: If the input is: 10 21 2 -6 the output is: 2 and 21 You can assume that the list of integers will have at least 2 values.
5.18 LAB: Smallest and largest numbers in a list Instructor note: Feel free to use Python's built-in min() and max() functions to solve this. The heart of this lab is the first part: constructing a list of values from user-entered input. Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smallest and largest integers in the list. Ex: If the input is: 10 21 2 -6 the output is: 2 and 21 You can assume that the list of integers will have at least 2 values.
C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter16: Searching, Sorting And Vector Type
Section: Chapter Questions
Problem 1TF
Related questions
Question
In python
![5.18 LAB: Smallest and largest numbers in a list
Instructor note:
Feel free to use Python's built-in min() and max() functions to solve this. The heart of this lab is the first part: constructing a list of
values from user-entered input.
Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smallest and largest
integers in the list.
Ex: If the input is:
10
5
3
21
-6
the output is:
2 and 21
You can assume that the list of integers will have at least 2 values.](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fffc07224-a410-4a6f-ad12-a8be08002c29%2F336c816f-cf8d-4224-bd80-d357cf904361%2Fq2odjm_processed.png&w=3840&q=75)
Transcribed Image Text:5.18 LAB: Smallest and largest numbers in a list
Instructor note:
Feel free to use Python's built-in min() and max() functions to solve this. The heart of this lab is the first part: constructing a list of
values from user-entered input.
Write a program that reads a list of integers into a list as long as the integers are greater than zero, then outputs the smallest and largest
integers in the list.
Ex: If the input is:
10
5
3
21
-6
the output is:
2 and 21
You can assume that the list of integers will have at least 2 values.
Expert Solution
![](/static/compass_v2/shared-icons/check-mark.png)
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 2 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
I keep getting this
l=[]
while(True):
n=int(input())
if(n<=0):
break
else:
l.append(n)
print(min(l),"and",max(l))
Solution
Recommended textbooks for you
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning
![C++ Programming: From Problem Analysis to Program…](https://www.bartleby.com/isbn_cover_images/9781337102087/9781337102087_smallCoverImage.gif)
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning