48.6k views
1 vote
In a new module named removeMinimum.py Write a function calledremoveMin()that removes the minimum value from a list. Youcannotuse the existingminfunction nor the existing remove method. Of a list has more than one copy of theminimum value, remove only the rst occurrence. [HINT: Create your own minfunction that nds the minimum element in a list and use it in a separate functionremoveMin(). Use help(list.remove) in your console for more information abouttheremove()method for lists]Here is a sample console run of how your function should work:

1 Answer

3 votes

Answer:

The removeMin() function is as follows:

def removeMin(mylist):

mylist.remove(min(mylist))

print(mylist)

Step-by-step explanation:

This line declares the function removeMin()

def removeMin(mylist):

This line removes the minimum item in the list

mylist.remove(min(mylist))

This line prints the remaining items in the list

print(mylist)

User Siarhei Fedartsou
by
5.6k points