When provided with a number between 0-9, return it in words.

Input :: 1

Output :: "One".

If your language supports it, try using a switch statement.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def switch_it_up(number):
	

Solutions:
def switch_it_up(n):
	return ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine'][n]


def switch_it_up(number):
	number_converter = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}
	return number_converter[number]


def switch_it_up(number):
	return 'Zero One Two Three Four Five Six Seven Eight Nine'.split()[number]


switch_it_up = lambda n: ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine'][n]


switch_it_up = lambda n: 'ZOTTFFSSENenwhoiieiireoruvxvgno  ere ehe   e   nt '[n::10].strip()


def switch_it_up(number):
	l = ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine']
	return ''.join((l[i] for i in range(10) if number == i))


switch_it_up = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}.get


def switch_it_up(number):
	d = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
	return d[number].capitalize()


def switch_it_up(number):
	return __import__('unicodedata').name(str(number)).title()[6:]


def switch_it_up(number):
	switch = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}
	return switch.get(number, 'Number must be >= 0 and < 10')


def switch_it_up(number):
	return 'zero one two three four five six seven eight nine'.title().split()[number]


def switch_it_up(number):
	dict_ = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}
	return dict_.get(number, 'Not Found')


def switch_it_up(number):
	return ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine'][number] if 0 <= number < 10 else 'Hæ?'


switch_it_up = ('Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine').__getitem__


def switch_it_up(number):
	import unicodedata
	return unicodedata.name(str(number)).split(None)[1].title()


def switch_it_up(n):

	def zero():
		return 'Zero'

	def one():
		return 'One'

	def two():
		return 'Two'

	def three():
		return 'Three'

	def four():
		return 'Four'

	def five():
		return 'Five'

	def six():
		return 'Six'

	def seven():
		return 'Seven'

	def eight():
		return 'Eight'

	def nine():
		return 'Nine'
	options = {None: zero, 0: zero, 1: one, 2: two, 3: three, 4: four, 5: five, 6: six, 7: seven, 8: eight, 9: nine}
	return options[n]()


def switch_it_up(number=0):
	switcher = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine', 10: 'Ten'}
	return switcher.get(number)


ENGLISH_NUMBE_NAMES = ('Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine')

def switch_it_up(number: int) -> str:
	if 0 <= number < len(ENGLISH_NUMBE_NAMES):
		return ENGLISH_NUMBE_NAMES[number]
	else:
		return str(number)


def switch_it_up(number):
	if str(number).isdecimal():
		return {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 0: 'zero'}.get(number).title()


def switch_it_up(number):
	return 'Zero' if number == 0 else 'One' if number == 1 else 'Two' if number == 2 else 'Three' if number == 3 else 'Four' if number == 4 else 'Five' if number == 5 else 'Six' if number == 6 else 'Seven' if number == 7 else 'Eight' if number == 8 else 'Nine' if number == 9 else 'This is dumb...'


def switch_it_up(num):
	if num == 1:
		return 'One'
	elif num == 2:
		return 'Two'
	elif num == 3:
		return 'Three'
	elif num == 4:
		return 'Four'
	elif num == 5:
		return 'Five'
	elif num == 6:
		return 'Six'
	elif num == 7:
		return 'Seven'
	elif num == 8:
		return 'Eight'
	elif num == 0:
		return 'Zero'
	else:
		return 'Nine'


def switch_it_up(n):
	return 'One' if n == 1 else 'Two' if n == 2 else 'Three' if n == 3 else 'Four' if n == 4 else 'Five' if n == 5 else 'Six' if n == 6 else 'Seven' if n == 7 else 'Eight' if n == 8 else 'Nine' if n == 9 else 'Zero'


def switch_it_up(n):
	return ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine'][n].title()


def switch_it_up(x):
	numbers = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']
	return numbers[x].capitalize()


def switch_it_up(number):
	nums = {'Zero': 0, 'One': 1, 'Two': 2, 'Three': 3, 'Four': 4, 'Five': 5, 'Six': 6, 'Seven': 7, 'Eight': 8, 'Nine': 9}
	for (k, v) in nums.items():
		if v == number:
			return k


def switch_it_up(number):
	lst = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 'Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine']
	ind = lst.index(number)
	return lst[ind + 10]


def switch_it_up(num):
	d = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine', 10: 'Ten', 11: 'Eleven', 12: 'Twelve', 13: 'Thirteen', 14: 'fourteen', 15: 'Fifteen', 16: 'Sixteen', 17: 'Seventeen', 18: 'eighteen', 19: 'Nineteen', 20: 'Twenty', 30: 'Thirty', 40: 'Forty', 50: 'Fifty', 60: 'Sixty', 70: 'Seventy', 80: 'Eighty', 90: 'Ninety'}
	k = 1000
	m = k * 1000
	b = m * 1000
	t = b * 1000
	assert 0 <= num
	if num < 20:
		return d[num]
	if num < 100:
		if num % 10 == 0:
			return d[num]
		else:
			return d[num // 10 * 10] + '-' + d[num % 10]
	if num < k:
		if num % 100 == 0:
			return d[num // 100] + ' hundred'
		else:
			return d[num // 100] + ' hundred and ' + int_to_en(num % 100)
	if num < m:
		if num % k == 0:
			return int_to_en(num // k) + ' thousand'
		else:
			return int_to_en(num // k) + ' thousand, ' + int_to_en(num % k)
	if num < b:
		if num % m == 0:
			return int_to_en(num // m) + ' million'
		else:
			return int_to_en(num // m) + ' million, ' + int_to_en(num % m)
	if num < t:
		if num % b == 0:
			return int_to_en(num // b) + ' billion'
		else:
			return int_to_en(num // b) + ' billion, ' + int_to_en(num % b)
	if num % t == 0:
		return int_to_en(num // t) + ' trillion'
	else:
		return int_to_en(num // t) + ' trillion, ' + int_to_en(num % t)
	raise AssertionError('num is too large: %s' % str(num))


def switch_it_up(number):
	num_in_words = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}
	return num_in_words.get(number, 'enter any number from 0 through 9')


def switch_it_up(number):
	cases = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}
	return cases.get(number, 'Invalid value')


def switch_it_up(number):
	a = {1: 'One', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 0: 'zero'}
	return a[number].title()


def switch_it_up(number):
	a_dict = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}
	for value in a_dict.values():
		needed = a_dict[number]
	return needed


stringNum = {1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine', 0: 'Zero'}

def switch_it_up(number):
	if number in stringNum.keys():
		return stringNum[number]


def switch_it_up(number):
	return dict(zip(list(range(0, 10)), ['Zero', 'One', 'Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine'])).get(number)


def switch_it_up(number):
	return {1: 'one', 2: 'two', 3: 'three', 4: 'four', 5: 'five', 6: 'six', 7: 'seven', 8: 'eight', 9: 'nine', 0: 'zero'}.get(number).capitalize()


def switch_it_up(number):
	nums = {'Zero': 0, 'One': 1, 'Two': 2, 'Three': 3, 'Four': 4, 'Five': 5, 'Six': 6, 'Seven': 7, 'Eight': 8, 'Nine': 9, 'Ten': 10}
	for (key, value) in nums.items():
		if value == number:
			return key


def switch_it_up(n):
	d = {0: 'Zero', 1: 'One', 2: 'Two', 3: 'Three', 4: 'Four', 5: 'Five', 6: 'Six', 7: 'Seven', 8: 'Eight', 9: 'Nine'}
	return d.get(n, 0)


def switch_it_up(number):
	numbers = 'Zero-One-Two-Three-Four-Five-Six-Seven-Eight-Nine'.split('-')
	return numbers[number] if number < len(numbers) else 'Error'