Skip to content

Max Difference

Andrew Burke edited this page Apr 3, 2024 · 5 revisions
def max_difference(lst):
	max_val = lst[0]
	min_val = lst[0]
	
	for num in lst:
		if num > max_val:
			max_val = num
		if num < min_val:
			min_val = num
	
	return max_val - min_val
Clone this wiki locally