Computer Science, asked by lipumaity, 11 months ago

Write a program in python to find minimum element along with its index value from a list of elements ​

Answers

Answered by superfunky
5

Answer:

the simplest and smartest way

Explanation:

# Python Program to find Smallest Number in a List  and position

a = [10, 50, 60, 80, 20, 15]

print("The Smallest Element in this List is : ",min(a))

print("The position of the smallest element is : ",a.index(min(a)))

Answered by AskewTronics
2

Program in Python :

Explanation:

size=int(input("Enter the size of the list: "))#take input for the size of the list.

list1=[]#intialize the list.

for x in range(size):#for input the list.

   value=int(input("Enter the value: "))#take the value for the list.

   list1.append(value)#assign the value on the list.

minimum=list1[0]

for x in list1: #to find the minimum value of the list.

   if(x<minimum):#check the minimum value.

       minimum=x

print("The minimum value of the list",end=": ")#print the message.

print(list1,end="are ")#print the list.

print(minimum)#print the minimum value.

Output:

  • If the user input 1,2,3,4,5 for the list, then minimum value is 1.

Code Explanation:

  • The above code is in python language which holds the two loop.
  • First loop is used to take the value from the user and add it on the list.
  • Then the second loop traverse the list and find the minimum value from the list.
  • Then the list value and minimum value is printed on the screen by the help of print function.

Learn More:

  • Python : https://brainly.in/question/14689905
Similar questions