Implement a function that returns the minimal and the maximal value of a list (in this order).

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def get_min_max(seq):
	

Solutions:
def get_min_max(seq):
	return (min(seq), max(seq))


def get_min_max(L):
	return (min(L), max(L))


get_min_max = lambda seq: (min(seq), max(seq))


def get_min_max(seq):
	max = seq[0]
	min = seq[0]
	for a in seq:
		if a > max:
			max = a
		if a < min:
			min = a
	return (min, max)


def get_min_max(seq):
	return (min(seq), max(seq)) if len(seq) > 1 else (seq[0], seq[0])


def get_min_max(seq):
	s = sorted(seq)
	return (s[0], s[-1])


def get_min_max(seq):
	seq = iter(seq)
	seq_min = seq_max = next(seq)
	while True:
		try:
			a = next(seq)
		except StopIteration:
			break
		b = next(seq, seq_min)
		if a > b:
			seq_min = min(b, seq_min)
			seq_max = max(a, seq_max)
		else:
			seq_min = min(a, seq_min)
			seq_max = max(b, seq_max)
	return (seq_min, seq_max)


def get_min_max(seq):
	seq.sort()
	return (seq[0], seq[0]) if len(seq) is 1 else (seq[0], seq[len(seq) - 1])


def get_min_max(seq):
	min = seq[0]
	max = seq[0]
	for number in seq:
		if number > max:
			max = number
	for number in seq:
		if number < min:
			min = number
	return (min, max)