How many licks does it take to get to the tootsie roll center of a tootsie pop?

A group of engineering students from Purdue University reported that its licking machine, modeled after a human tongue, took an average of 364 licks to get to the center of a Tootsie Pop. Twenty of the group's volunteers assumed the licking challenge-unassisted by machinery-and averaged 252 licks each to the center.

Your task, if you choose to accept it, is to write a function that will return the number of licks it took to get to the tootsie roll center of a tootsie pop, given some environmental variables.

Everyone knows it's harder to lick a tootsie pop in cold weather but it's easier if the sun is out. You will be given an object of environmental conditions for each trial paired with a value that will increase or decrease the number of licks. The environmental conditions all apply to the same trial.

Assuming that it would normally take 252 licks to get to the tootsie roll center of a tootsie pop, return the new total of licks along with the condition that proved to be most challenging (causing the most added licks) in that trial.

Example:
```
totalLicks({ "freezing temps": 10, "clear skies": -2 });
```
Should return:
```
"It took 260 licks to get to the tootsie roll center of a tootsie pop. The toughest challenge was freezing temps."
```
Other cases:
If there are no challenges, the toughest challenge sentence should be omitted. If there are multiple challenges with the highest toughest amount, the first one presented will be the toughest.
If an environment variable is present, it will be either a positive or negative integer. No need to validate.


Check out my other 80's Kids Katas:


80's Kids #1: How Many Licks Does It Take
80's Kids #2: Help Alf Find His Spaceship
80's Kids #3: Punky Brewster's Socks
80's Kids #4: Legends of the Hidden Temple
80's Kids #5: You Can't Do That on Television
80's Kids #6: Rock 'Em, Sock 'Em Robots
80's Kids #7: She's a Small Wonder
80's Kids #8: The Secret World of Alex Mack
80's Kids #9: Down in Fraggle Rock 
80's Kids #10: Captain Planet

Difficulty: EASY

Starter code:
def total_licks(env):
	

Solutions:
def total_licks(env):
	d = 252
	vm = 0
	for (k, v) in env.items():
		d += v
		if v > vm:
			(vm, km) = (v, k)
	return 'It took ' + str(d) + ' licks to get to the tootsie roll center of a tootsie pop.' + (' The toughest challenge was ' + km + '.' if vm > 0 else '')


from operator import itemgetter
TOTAL_LICKS = 252

def total_licks(env):
	message = 'It took %d licks to get to the tootsie roll center of a tootsie pop.' % (TOTAL_LICKS + sum(env.values()))
	if env:
		toughest_challenge = max(iter(env.items()), key=itemgetter(1))
		if toughest_challenge[1] > 0:
			message += ' The toughest challenge was %s.' % toughest_challenge[0]
	return message


def total_licks(env):
	s = 'It took {} licks to get to the tootsie roll center of a tootsie pop.'.format(252 + sum(env.values()))
	if any((x > 0 for x in env.values())):
		key = max(env, key=env.get)
		s += ' The toughest challenge was {}.'.format(key)
	return s


def total_licks(env):
	sLicks = f'It took {252 + sum(env.values())} licks to get to the tootsie roll center of a tootsie pop.'
	if env and max(env.values()) > 0:
		sLicks += f' The toughest challenge was {max(env, key=env.get)}.'
	return sLicks


from operator import itemgetter
from typing import Dict

def total_licks(env: Dict[str, int]) -> str:
	t = max(list(env.items()), key=itemgetter(1), default=('', 0))
	return f"It took {252 + sum(env.values())} licks to get to the tootsie roll center of a tootsie pop.{(f' The toughest challenge was {t[0]}.' if t[1] > 0 else '')}"


def total_licks(env):
	tough = max(env.items(), key=lambda x: x[1]) if env else [0, 0]
	total = sum((v for v in env.values()))
	output = 'It took {} licks to get to the tootsie roll center of a tootsie pop.'.format(252 + total)
	if tough[1] > 0:
		output += ' The toughest challenge was {}.'.format(tough[0])
	return output


def total_licks(env):
	licks = 'It took {} licks to get to the tootsie roll center of a tootsie pop.'.format(252 + sum(env.values()))
	(toughest_key, toughest_value) = max(env.items(), key=lambda item: item[1]) if env else ('', 0)
	toughest_msg = ' The toughest challenge was {}.'.format(toughest_key) if toughest_value > 0 else ''
	return licks + toughest_msg


def total_licks(env):
	licks = 252
	if env == {}:
		return f'It took {licks} licks to get to the tootsie roll center of a tootsie pop.'
	for challenge in env.items():
		licks += challenge[1]
	max_challenge = max(env.values())
	if max_challenge < 0:
		return f'It took {licks} licks to get to the tootsie roll center of a tootsie pop.'
	for cha in env.keys():
		if env[cha] == max_challenge:
			challenge = cha
	return f'It took {licks} licks to get to the tootsie roll center of a tootsie pop. The toughest challenge was {challenge}.'


def total_licks(env):
	n = 252
	s = ''
	for (k, v) in list(env.items()):
		n += v
		if v > 0:
			if max(env, key=env.get) not in s:
				s += max(env, key=env.get)
	if env == {} or s == '':
		return f'It took {n} licks to get to the tootsie roll center of a tootsie pop.'
	else:
		return f'It took {n} licks to get to the tootsie roll center of a tootsie pop. The toughest challenge was {s}.'


def total_licks(env):
	licks = 252 + sum(env.values())
	challenge = max(([v, k] for (k, v) in env.items() if v > 0), default=None)
	result = f'It took {licks} licks to get to the tootsie roll center of a tootsie pop.'
	if challenge:
		result += f' The toughest challenge was {challenge[1]}.'
	return result