Your start-up's BA has told marketing that your website has a large audience in Scandinavia and surrounding countries. Marketing thinks it would be great to welcome visitors to the site in their own language. Luckily you already use an API that detects the user's location, so this is an easy win. 

### The Task
- Think of a way to store the languages as a database (eg an object). The languages are listed below so you can copy and paste!
- Write a 'welcome' function that takes a parameter 'language' (always a string), and returns a greeting - if you have it in your database. It should default to English if the language is not in the database, or in the event of an invalid input.

### The Database

```python
'english': 'Welcome',
'czech': 'Vitejte',
'danish': 'Velkomst',
'dutch': 'Welkom',
'estonian': 'Tere tulemast',
'finnish': 'Tervetuloa',
'flemish': 'Welgekomen',
'french': 'Bienvenue',
'german': 'Willkommen',
'irish': 'Failte',
'italian': 'Benvenuto',
'latvian': 'Gaidits',
'lithuanian': 'Laukiamas',
'polish': 'Witamy',
'spanish': 'Bienvenido',
'swedish': 'Valkommen',
'welsh': 'Croeso'
```
``` java
english: "Welcome",
czech: "Vitejte",
danish: "Velkomst",
dutch: "Welkom",
estonian: "Tere tulemast",
finnish: "Tervetuloa",
flemish: "Welgekomen",
french: "Bienvenue",
german: "Willkommen",
irish: "Failte",
italian: "Benvenuto",
latvian: "Gaidits",
lithuanian: "Laukiamas",
polish: "Witamy",
spanish: "Bienvenido",
swedish: "Valkommen",
welsh: "Croeso"
```

Possible invalid inputs include:
~~~~
IP_ADDRESS_INVALID - not a valid ipv4 or ipv6 ip address
IP_ADDRESS_NOT_FOUND - ip address not in the database
IP_ADDRESS_REQUIRED - no ip address was supplied
~~~~

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def greet(language):
	

Solutions:
def greet(language):
	return {'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'english': 'Welcome', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso'}.get(language, 'Welcome')


def greet(language):
	print(language)
	B = {'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso'}
	if language in B:
		x = B[language]
		print(x)
		return x
	else:
		return 'Welcome'


def greet(language):
	database = {'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso'}
	for (k, v) in database.items():
		if k == language:
			return v
	return 'Welcome'


def greet(language):
	if language == 'english':
		return 'Welcome'
	elif language == 'czech':
		return 'Vitejte'
	elif language == 'danish':
		return 'Velkomst'
	elif language == 'dutch':
		return 'Welkom'
	elif language == 'estonian':
		return 'Tere tulemast'
	elif language == 'finnish':
		return 'Tervetuloa'
	elif language == 'fllemish':
		return 'Welgekomen'
	elif language == 'french':
		return 'Bienvenue'
	elif language == 'german':
		return 'Willkommen'
	elif language == 'italian':
		return 'Benvenuto'
	elif language == 'latvian':
		return 'Gaidits'
	elif language == 'lithuanian':
		return 'Laukiamas'
	elif language == 'polish':
		return 'Witamy'
	elif language == 'spanish':
		return 'Bienvenido'
	elif language == 'swedish':
		return 'Valkommen'
	elif language == 'welsh':
		return 'Croeso'
	else:
		return 'Welcome'


def greet(language='Welcome'):
	while 0 == 0:
		if isinstance(language, int):
			return 'Welcome'
		else:
			return {'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso', 'IP_ADDRESS_INVALID': 'Welcome', 'IP_ADDRESS_NOT_FOUND': 'Welcome', 'IP_ADDRESS_REQUIRED': 'Welcome'}.get(language) if language else 'Welcome'


def greet(language):
	return {'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso', 'ip_address_invalid': 'not a valid ipv4 or ipv6 ip address', 'ip_address_not_found': 'ip address not in the database', 'ip_address_required': 'no ip address was supplied'}.get(language, 'Welcome')


listlang = {'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso', 'IP_ADDRESS_INVALID': 'Welcome', 'IP_ADDRESS_NOT_FOUND ': 'Welcome', 'IP_ADDRESS_REQUIRED ': 'Welcome', '': 'Welcome', 2: 'Welcome'}

def greet(language='Welcome'):
	if language in listlang:
		return listlang[language]
	else:
		return 'Welcome'


def greet(language='english'):
	myDict = {'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso'}
	key_list = list(myDict.keys())
	value_list = list(myDict.values())
	try:
		return value_list[key_list.index(language)]
	except ValueError:
		return value_list[key_list.index('english')]


dict = {'english': 'Welcome', 'czech': 'Vitejte', 'danish': 'Velkomst', 'dutch': 'Welkom', 'estonian': 'Tere tulemast', 'finnish': 'Tervetuloa', 'flemish': 'Welgekomen', 'french': 'Bienvenue', 'german': 'Willkommen', 'irish': 'Failte', 'italian': 'Benvenuto', 'latvian': 'Gaidits', 'lithuanian': 'Laukiamas', 'polish': 'Witamy', 'spanish': 'Bienvenido', 'swedish': 'Valkommen', 'welsh': 'Croeso'}
greet = lambda l: dict[l] if l in dict else dict['english']