Reducing Problems - Bug Fixing #8

Oh no! Timmy's reduce is causing problems, Timmy's goal is to calculate the two teams scores and return the winner but timmy has gotten confused and sometimes teams don't enter their scores, total the scores out of 3! Help timmy fix his program!

Return true if team 1 wins or false if team 2 wins!

Difficulty: EASY
Starter code: def calculate_total(t1, t2):
	

Solutions:
def calculate_total(team1, team2):
	return sum(team1) > sum(team2)


def calculate_total(t1, t2):
	return sum(t1) > sum(t2)


def calculate_total(t1, t2):
	if sum(t1) > sum(t2):
		return True
	else:
		return False


def calculate_total(t1s, t2s):
	return sum(t1s) > sum(t2s)


def calculate_total(t1, t2):
	t1s = sum(t1) if t1 else -1
	t2s = sum(t2) if t2 else -1
	return True if t1s > t2s else False


from functools import reduce

def calculate_total(t1, t2):
	f = lambda t: reduce(lambda a, b: a + b, t, 0)
	return f(t1) > f(t2)