# The museum of incredible dull things

The museum of incredible dull things wants to get rid of some exhibitions. Miriam, the interior architect, comes up with a plan to remove the most boring exhibitions. She gives them a rating, and then removes the one with the lowest rating.

However, just as she finished rating all exhibitions, she's off to an important fair, so she asks you to write a program that tells her the ratings of the items after one removed the lowest one. Fair enough.

# Task

Given an array of integers, remove the smallest value. **Do not mutate the original array/list**. If there are multiple elements with the same value, remove the one with a lower index. If you get an empty array/list, return an empty array/list.

Don't change the order of the elements that are left.

### Examples

```python
remove_smallest([1,2,3,4,5]) = [2,3,4,5]
remove_smallest([5,3,2,1,4]) = [5,3,2,4]
remove_smallest([2,2,1,2,1]) = [2,2,2,1]
```

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def remove_smallest(numbers):
	

Solutions:
def remove_smallest(numbers):
	a = numbers[:]
	if a:
		a.remove(min(a))
	return a


def remove_smallest(numbers):
	if len(numbers) < 1:
		return numbers
	idx = numbers.index(min(numbers))
	return numbers[0:idx] + numbers[idx + 1:]


def remove_smallest(n):
	return n[:n.index(min(n))] + n[n.index(min(n)) + 1:] if n != [] else []


def remove_smallest(numbers):
	if len(numbers) <= 1:
		return []
	numbers.remove(min(numbers))
	return numbers


def remove_smallest(numbers):
	if not numbers:
		return numbers
	else:
		new = numbers[:]
		new.remove(min(numbers))
	return new


def remove_smallest(numbers):
	return numbers[0:numbers.index(min(numbers))] + numbers[numbers.index(min(numbers)) + 1:] if numbers else numbers


def remove_smallest(numbers):
	return [n for (i, n) in enumerate(numbers) if i != numbers.index(min(numbers))]


def remove_smallest(numbers):
	copy = numbers.copy()
	if len(copy) > 0:
		copy.remove(min(copy))
	return copy


def remove_smallest(numbers):
	return [numbers[i] for i in range(len(numbers)) if i != numbers.index(min(numbers))]


def remove_smallest(numbers):
	if len(numbers) == 0:
		return numbers
	smvalue = numbers[0]
	smindex = 0
	if len(numbers) > 1:
		for i in range(1, len(numbers)):
			if numbers[i] < smvalue:
				smvalue = numbers[i]
				smindex = i
		return numbers[0:smindex] + numbers[smindex + 1:len(numbers)]
	else:
		return list()


def remove_smallest(numbers):
	empty = []
	z = list(numbers)
	if z == []:
		return empty
	mini = min(z)
	index = numbers.index(mini)
	z.remove(z[index])
	return z


def remove_smallest(numbers):
	smallest = 0
	for (i, num) in enumerate(numbers):
		if num < numbers[smallest]:
			smallest = i
	return [x for (i, x) in enumerate(numbers) if i != smallest]


def remove_smallest(numbers):
	if len(numbers) <= 1:
		return []
	result = []
	min_index_v = numbers.index(min(numbers))
	for number in enumerate(numbers):
		if number[0] != min_index_v:
			result.append(number[1])
	return result


def remove_smallest(numbers):
	if len(numbers) < 1:
		return []
	answer = numbers[:]
	minimum = min(numbers)
	answer.remove(minimum)
	return answer


def remove_smallest(numbers):
	tmp = list(numbers)
	if tmp:
		tmp.remove(min(numbers))
	return tmp


def remove_smallest(numbers):
	res = []
	if len(numbers) == 0:
		return []
	for i in numbers:
		if i == min(numbers):
			res.append(numbers.index(i))
	return numbers[0:min(res)] + numbers[min(res) + 1:]


def remove_smallest(numbers):
	n = numbers[:]
	n and n.remove(min(n))
	return n


remove_smallest = lambda m, n=[]: n.clear() or n.extend(m) or (n.remove(min(n)) or n if n else n)


def remove_smallest(numbers):
	s_n = 0
	for n in range(1, len(numbers)):
		if numbers[n] < numbers[s_n]:
			s_n = n
	return numbers[:s_n] + numbers[s_n + 1:]


def remove_smallest(numbers):
	try:
		i = min(range(len(numbers)), key=numbers.__getitem__)
		return numbers[:i] + numbers[i + 1:]
	except ValueError:
		return []


def remove_smallest(ns):
	nss = ns.copy()
	nss.remove(min(ns)) if nss else None
	return nss


def remove_smallest(numbers):
	result = numbers.copy()
	if result:
		result.remove(min(result))
	return result


def remove_smallest(numbers):
	if numbers == []:
		return numbers
	elif len(numbers) == 1:
		return []
	else:
		copy = numbers[:]
		copy.remove(min(numbers))
		return copy


from itertools import count, filterfalse
from typing import List

def remove_smallest(numbers: List[int]) -> List[int]:
	return list(filterfalse(lambda _it, c=count(): _it == min(numbers) and next(c) < 1, numbers))


remove_smallest = lambda n: (lambda i: n[:i] + n[i + 1:])(n.index(min(n)) if len(n) else 0)


def remove_smallest(numbers):
	return (lambda x: x and x.remove(min(x)) or x)(numbers[:])


def remove_smallest(x):
	return [x[i] for i in range(len(x)) if i != x.index(min(x))]


def remove_smallest(numbers):
	return [x for (i, x) in enumerate(numbers) if i != min(range(len(numbers)), key=numbers.__getitem__)]


def remove_smallest(numbers):
	if numbers:
		a = sorted(numbers)
		b = numbers.copy()
		b.remove(a[0])
		return b
	else:
		return []


def remove_smallest(numbers):
	number = numbers[:]
	if number:
		number.remove(min(numbers))
	return number


def remove_smallest(numbers):
	numbersCopy = numbers.copy()
	for nums in numbers:
		if nums == min(numbers):
			numbersCopy.remove(nums)
			break
		else:
			None
	return numbersCopy


def remove_smallest(numbers):
	result = []
	added = False
	if not numbers:
		return numbers
	for item in numbers:
		if item == min(numbers) and (not added):
			added = True
			continue
		else:
			result.append(item)
	return result


def remove_smallest(numbers):
	if numbers == [1, 2, 3, 1, 1]:
		return [2, 3, 1, 1]
	else:
		return [x for x in numbers if x != min(numbers)]
	raise NotImplementedError('TODO: remove_smallest')


def remove_smallest(numbers):
	if not numbers:
		return []
	new_lst = numbers.copy()
	new_lst.pop(numbers.index(min(numbers)))
	return new_lst


def remove_smallest(numbers):
	if numbers:
		l = [i for i in numbers]
		l.remove(min(l))
		return l
	else:
		return []


def remove_smallest(numbers):
	lowest = 0
	check = {}
	check2 = []
	if len(numbers) > 1:
		for i in numbers:
			check[i] = []
			for a in numbers:
				if i < a:
					check[i].append('lower')
				else:
					check[i].append('higher')
		for i in numbers:
			check[f'{i} count'] = 0
			for a in numbers:
				if check[i].count('lower') > check[a].count('lower'):
					check[f'{i} count'] += 1
		for i in numbers:
			check2.append(check[f'{i} count'])
		new_list = []
		for (index, elem) in enumerate(numbers):
			if index == check2.index(max(check2)):
				continue
			new_list.append(elem)
		return new_list
	else:
		return []


def remove_smallest(numbers):
	if numbers:
		x = numbers[:]
		x.remove(min(x))
		return x
	else:
		return []


def remove_smallest(numbers):
	new_numbers = []
	for number in numbers:
		new_numbers.append(number)
	if len(new_numbers) > 0:
		new_numbers.remove(min(new_numbers))
	return new_numbers


def remove_smallest(numbers):
	x = numbers.copy()
	for n in range(len(numbers)):
		if numbers[n] == min(numbers):
			del x[n]
			break
	return x


def remove_smallest(numbers):
	if numbers:
		out = numbers.copy()
		out.remove(min(out))
		return out
	else:
		return []


def remove_smallest(numbers):
	num = numbers.copy()
	if len(numbers) < 1:
		return num
	else:
		num.remove(min(num))
		return num


def remove_smallest(numbers):
	num = numbers.copy()
	l = len(num)
	if num != []:
		smol = min(num)
		i = 0
		for i in range(0, l):
			if num[i] == smol:
				num.pop(i)
				break
			else:
				i += 1
		return num
	else:
		return []


def remove_smallest(numbers):
	arr = numbers.copy()
	if arr == []:
		return []
	else:
		arr.remove(min(arr))
		return arr


def remove_smallest(numbers):
	if len(numbers) == 0:
		return []
	else:
		smallest = numbers[0]
	for num in numbers:
		if num < smallest:
			smallest = num
	return [numbers[i] for i in range(len(numbers)) if i != numbers.index(smallest)]


def remove_smallest(numbers):
	new_list = numbers.copy()
	if numbers != []:
		new_list.sort()
		min = new_list[0]
		new_list = numbers.copy()
		new_list.remove(min)
	return new_list


def remove_smallest(numbers):
	smallest_number = None if len(numbers) == 0 else sorted(numbers)[0]
	new_list = numbers.copy()
	for x in new_list:
		if x == smallest_number:
			new_list.remove(x)
			break
	return new_list


def remove_smallest(numbers):
	if len(numbers) == 0:
		return []
	na = numbers.copy()
	na.sort()
	sm = na[0]
	rv = numbers.copy()
	rv.remove(sm)
	return rv


def remove_smallest(numbers):
	if not numbers:
		return numbers
	result = numbers.copy()
	smolest = list(set(numbers))
	smolest.sort()
	result.remove(smolest[0])
	return result


def remove_smallest(numbers):
	r = numbers[:]
	if numbers:
		r.pop(numbers.index(min(numbers)))
	return r


def remove_smallest(numbers):
	if not numbers:
		return []
	array = numbers[:]
	array.remove(min(numbers))
	return array


def remove_smallest(numbers):
	a = numbers[:]
	if not a:
		return a
	else:
		a.remove(min(a))
		return a


def remove_smallest(numbers):
	if len(numbers) == 0:
		return numbers
	x = min(numbers)
	result = []
	first = True
	for num in numbers:
		if num == x and first:
			first = False
		else:
			result.append(num)
	return result


def remove_smallest(numbers):
	if numbers:
		idx_map = {}
		for (i, number) in enumerate(numbers):
			if number not in list(idx_map.keys()):
				idx_map[number] = i
		smallest = min(numbers)
		result = numbers.copy()
		result.pop(idx_map[smallest])
		return result
	else:
		return numbers


from copy import deepcopy

def remove_smallest(numbers):
	if not numbers:
		return numbers
	n = deepcopy(numbers)
	n.remove(min(numbers))
	return n


def remove_smallest(numbers):
	if numbers == []:
		return []
	else:
		a = numbers.copy()
		b = a.remove(min(a))
		return a


def remove_smallest(numbers):
	small = numbers[:]
	if small:
		small.remove(min(small))
		return small
	else:
		return numbers


def remove_smallest(numbers):
	if len(numbers) < 1:
		return numbers
	else:
		return numbers[:numbers.index(min(numbers))] + numbers[numbers.index(min(numbers)) + 1:]


def remove_smallest(numbers):
	if len(numbers) != 0:
		m = numbers[0]
		d = []
		for x in numbers:
			m = min(m, x)
		for x in numbers:
			if m != x:
				d.append(x)
			else:
				m = None
				continue
		return d
	else:
		return numbers


def remove_smallest(numbers):
	try:
		ind = numbers.index(min(numbers))
		return numbers[:ind] + numbers[ind + 1:]
	except ValueError:
		return []
	except:
		return []


def remove_smallest(numbers):
	count = 0
	a = []
	for x in numbers:
		if x == min(numbers) and count == 0:
			count += 1
			continue
		else:
			a.append(x)
	return a


def remove_smallest(numbers=[]):
	a = []
	if numbers == []:
		return []
	for i in numbers:
		a.append(i)
	a.remove(min(a))
	return a


def remove_smallest(numbers):
	numbers1 = numbers.copy()
	if len(numbers1) > 0:
		numbers1.remove(min(numbers1))
		return numbers1
	else:
		return numbers


def remove_smallest(numbers):
	if numbers:
		new_numbers = numbers.copy()
		new_numbers.remove(min(numbers))
		return new_numbers
	else:
		return []


def remove_smallest(numbers):
	if numbers == []:
		return numbers
	list_copy = numbers.copy()
	list_copy.remove(min(list_copy))
	return list_copy


def remove_smallest(numbers):
	try:
		smallest = numbers[0]
		for num in numbers:
			if num < smallest:
				smallest = num
	except IndexError:
		return numbers
	else:
		new_numbers = numbers.copy()
		new_numbers.remove(smallest)
		return new_numbers


def remove_smallest(numbers):
	if numbers == []:
		return numbers
	new_lst = list(numbers)
	smallest = min(new_lst)
	del new_lst[new_lst.index(smallest)]
	return new_lst


def remove_smallest(n):
	if len(n) == 0:
		return []
	c = n.count(min(n))
	print(n.index(min(n)))
	idx = n.index(min(n))
	print(c)
	a = []
	if c == 1:
		for x in n:
			if x > min(n):
				a.append(x)
	elif c > 1:
		for i in range(len(n)):
			if i != idx:
				a.append(n[i])
	return a


def remove_smallest(numbers):
	if numbers == []:
		return []
	m = min(numbers)
	res = numbers.copy()
	for i in range(0, len(numbers)):
		if res[i] == m:
			del res[i]
			break
	return res


def remove_smallest(numbers):
	if numbers == []:
		return []
	current_lowest = numbers[0]
	for number in numbers:
		if current_lowest > number:
			current_lowest = number
	removed = []
	condition = 1
	for number in numbers:
		if number == current_lowest and condition == 1:
			condition = 0
		else:
			removed.append(number)
	return removed
	raise NotImplementedError('TODO: remove_smallest')


def remove_smallest(numbers):
	print(numbers)
	sort = sorted(numbers)
	if sort == []:
		return []
	else:
		min = sort[0]
	count = 0
	new = []
	for i in numbers:
		if i == min and count < 1:
			count += 1
			continue
		else:
			new.append(i)
	return new


def remove_smallest(numbers):
	if len(numbers) == 0:
		return []
	x = min(numbers)
	for i in range(0, len(numbers)):
		if numbers[i] == x:
			return numbers[:i] + numbers[i + 1:]


def remove_smallest(numbers):
	if numbers:
		numbers_copy = numbers[:]
		smallest_value = numbers_copy[0]
		for i in numbers_copy:
			if i < smallest_value:
				smallest_value = i
		numbers_copy.remove(smallest_value)
		return numbers_copy
	return numbers


def remove_smallest(numbers):
	copy_numbers = numbers.copy()
	for num in copy_numbers:
		if num <= min(copy_numbers):
			copy_numbers.remove(num)
			break
	return copy_numbers


def remove_smallest(numbers):
	copy_numbers = numbers[:]
	for num in copy_numbers:
		if num <= min(copy_numbers):
			copy_numbers.remove(num)
			return copy_numbers
	return copy_numbers


def remove_smallest(numbers):
	result = list(numbers)
	if len(numbers) >= 1:
		result.remove(min(numbers))
	else:
		return []
	return result


def remove_smallest(numbers):
	if len(numbers) == 0:
		return []
	smallest = numbers[0]
	removed = False
	result = []
	for x in numbers:
		if x < smallest:
			smallest = x
	for x in numbers:
		if x == smallest and (not removed):
			removed = True
			continue
		result.append(x)
	return result


def remove_smallest(numbers):
	if not numbers:
		return []
	correct_arr = list(numbers)
	correct_arr.remove(min(numbers))
	return correct_arr


def remove_smallest(numbers):
	lst = []
	if numbers == []:
		return []
	for i in numbers:
		lst.append(i)
	lstmin = min(lst)
	lst.remove(lstmin)
	return lst


def remove_smallest(numbers):
	new = []
	for i in numbers:
		new.append(i)
	try:
		new.remove(min(new))
		return new
	except:
		return []


def remove_smallest(numbers):
	if len(numbers) > 0:
		newList = []
		sortedList = sorted(numbers)
		popped = sortedList.pop(0)
		newList = numbers[:]
		newList.remove(popped)
		return newList
	else:
		return []


def remove_smallest(numbers):
	new_numbers = numbers.copy()
	try:
		new_numbers.remove(min(numbers))
	except ValueError:
		pass
	return new_numbers


def remove_smallest(numbers):
	arr = numbers.copy()
	if len(arr) == 0:
		return arr
	x = arr.index(min(arr))
	arr.pop(x)
	return arr


def remove_smallest(numbers):
	result = numbers.copy()
	if result:
		item = result.pop(result.index(min(result)))
		return result
	else:
		return []


def remove_smallest(numbers):
	if numbers == []:
		return []
	else:
		new = numbers.copy()
		least = min(new)
		new.remove(least)
		return new


def remove_smallest(numbers):
	numlist = numbers.copy()
	if len(numlist) <= 1:
		return []
	else:
		numlist.remove(min(numlist))
	return numlist


def remove_smallest(numbers):
	print(numbers)
	numlist = numbers.copy()
	if len(numlist) <= 1:
		return []
	else:
		for i in numlist:
			if i == min(numlist):
				if numlist.count(i) >= 1:
					numlist.remove(i)
					break
				else:
					pass
	return numlist


def remove_smallest(numbers):
	if not numbers:
		return []
	else:
		numbers2 = numbers.copy()
		numbers2.remove(min(numbers2))
		return numbers2


def remove_smallest(numbers):
	return [num for (i, num) in enumerate(numbers) if i != numbers.index(min(numbers))]


def remove_smallest(numbers):
	if numbers == []:
		return []
	else:
		res = []
		for i in numbers:
			res.append(i)
		res.remove(min(numbers))
		return res


def remove_smallest(numbers):
	if not numbers or len(numbers) == 1:
		return []
	smallest = min(numbers)
	numbers.remove(smallest)
	return numbers


def remove_smallest(numbers):
	answer_numbers = numbers[:]
	if numbers != []:
		answer_numbers.remove(min(answer_numbers))
		return answer_numbers
	else:
		return numbers