Lucy loves to travel. Luckily she is a renowned computer scientist and gets to travel to international conferences using her department's budget.

Each year, Society for Exciting Computer Science Research (SECSR) organizes several conferences around the world. Lucy always picks one conference from that list that is hosted in a city she hasn't been to before, and if that leaves her with more than one option, she picks the conference that she thinks would be most relevant for her field of research.

Write a function `conferencePicker` that takes in two arguments:

- `citiesVisited`, a list of cities that Lucy has visited before, given as an array of strings.
- `citiesOffered`, a list of cities that will host SECSR conferences this year, given as an array of strings. `citiesOffered` will already be ordered in terms of the relevance of the conferences for Lucy's research (from the most to the least relevant).

The function should return the city that Lucy should visit, as a string.

Also note:

- You should allow for the possibility that Lucy hasn't visited any city before.
- SECSR organizes at least two conferences each year.
- If all of the offered conferences are hosted in cities that Lucy has visited before, the function should return `'No worthwhile conferences this year!'` (`Nothing` in Haskell)

Example:

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Data structures

Starter code: def conference_picker(cities_visited, cities_offered):
	

Solutions:
def conference_picker(cities_visited, cities_offered):
	for city in cities_offered:
		if city not in cities_visited:
			return city
	return 'No worthwhile conferences this year!'


def conference_picker(visited, offered):
	visited = set(visited)
	return next((city for city in offered if city not in visited), 'No worthwhile conferences this year!')


def conference_picker(visited, offered):
	return [city for city in offered + ['No worthwhile conferences this year!'] if city not in visited][0]


def conference_picker(arr1, arr2):
	L = []
	for i in arr2:
		if i not in arr1:
			return i
			L.append(i)
	if L == []:
		return 'No worthwhile conferences this year!'


def conference_picker(cities_visited, cities_offered):
	picks = (city for city in cities_offered if city not in set(cities_visited))
	try:
		return next(picks)
	except StopIteration:
		return 'No worthwhile conferences this year!'


def conference_picker(visited, offered):
	options = [c for c in offered if c not in visited]
	return options[0] if options else 'No worthwhile conferences this year!'


def conference_picker(cities_visited, cities_offered):
	return next((c for c in cities_offered if c not in cities_visited), 'No worthwhile conferences this year!')


def conference_picker(cities_visited, cities_offered):
	SECSR = list(cities_visited)
	confPicker = list(cities_offered)
	shortList = list()
	for city in confPicker:
		if city not in SECSR:
			shortList.append(city)
		else:
			pass
	if len(shortList) > 0:
		return shortList[0]
	else:
		return 'No worthwhile conferences this year!'


def conference_picker(cities_visited, cities_offered):
	worthwile = set(cities_offered) - set(cities_visited)
	if worthwile:
		return min(worthwile, key=cities_offered.index)
	return 'No worthwhile conferences this year!'


conference_picker = lambda v, o: o[0] if len(v) == 0 else (lambda res: 'No worthwhile conferences this year!' if len(res) == 0 else res[0])([c for c in o if c not in v])


def conference_picker(cv, co):
	return [[i for i in co if not i in cv] + ['No worthwhile conferences this year!']][0][0]


def conference_picker(cities_visited, cities_offered):
	t = [i for i in cities_offered if i not in cities_visited]
	return t[0] if len(t) > 0 else 'No worthwhile conferences this year!'


def conference_picker(cities_visited, cities_offered):
	if len(cities_visited) == 0:
		return cities_offered[0]
	for city in cities_offered:
		if city in cities_visited:
			pass
		else:
			return city
	return 'No worthwhile conferences this year!'