Computer Science, asked by moneyzone42, 6 months ago

Write a program to display the maximum and minimum values from the specified range of indexes of a user given list​

Answers

Answered by ssinbox007
3

Answer:

IT IS A PYTHON PROGRAM

#Naive approach  

#to find index of maximum and  

#minimum element in the array.  

gfg_list=[8,1,7,10,5]  

#min and max indexes are taken 1st element  

#In some cases list might be a single element  

min_ele,max_ele=gfg_list[0],gfg_list[0]  

for i in range(1,len(gfg_list)):  

   if gfg_list[i]<min_ele:  

       min_ele=gfg_list[i]  

   if gfg_list[i]>max_ele:  

       max_ele=gfg_list[i]  

print('Minimum Element in the list',gfg_list,'is',min_ele)  

print('Maximum Element in the list',gfg_list,'is',max_ele)

Output:

Minimum Element in the list [8, 1, 7, 10, 5] is 1

Maximum Element in the list [8, 1, 7, 10, 5] is 10

Answered by soumilishr143
1

Please see the given attachment.

Hope it will help you.

Please mark as brainliest.

Attachments:
Similar questions