write a program to calculate the minimum element of a given list of number
Answers
Answered by
4
Answer:
Given a list of integers, the task is to generate another list with N minimum elements.
Examples:
Input: {23, 1, 6, 2, 90}
Output: {1, 2}
Input: {34, 21, 56, 42, 89, 90, -1}
Output: {-1, 21}
Approach: The idea is to use the concept used in Find the smallest and second smallest elements in an array.
First, find the smallest number in the given list.
Then add that current minimum element to another list that will contain the N minimum elements.
Remove the current minimum element from the given list.
Continue with the same process until the N minimum elements are found.
Answered by
8
Answer:
input:
list1=[1,2,3,4,5,0]
print(min(list1))
output:
0
Similar questions
English,
5 months ago
Social Sciences,
5 months ago
Math,
5 months ago
Chemistry,
11 months ago
Science,
11 months ago
Social Sciences,
1 year ago