You get any card as an argument. Your task is to return a suit of this card.

Our deck (is preloaded):
```python
DECK = ['2S','3S','4S','5S','6S','7S','8S','9S','10S','JS','QS','KS','AS',
        '2D','3D','4D','5D','6D','7D','8D','9D','10D','JD','QD','KD','AD',
        '2H','3H','4H','5H','6H','7H','8H','9H','10H','JH','QH','KH','AH',
        '2C','3C','4C','5C','6C','7C','8C','9C','10C','JC','QC','KC','AC']
```

```python
('3C') -> return 'clubs'
('3D') -> return 'diamonds'
('3H') -> return 'hearts'
('3S') -> return 'spades'
```

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Starter code: def define_suit(card):
	

Solutions:
def define_suit(card):
	d = {'C': 'clubs', 'S': 'spades', 'D': 'diamonds', 'H': 'hearts'}
	return d[card[-1]]


def define_suit(card):
	a = {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}
	return a.get(card[-1])


def define_suit(card):
	return next((suit for suit in ['clubs', 'diamonds', 'hearts', 'spades'] if card[-1].lower() == suit[0]))


def define_suit(card):
	print(card)
	dict = {'C': 'clubs', 'S': 'spades', 'D': 'diamonds', 'H': 'hearts'}
	return dict[card[-1]]


SUITS = 'diamonds clubs hearts spades clubs diamonds spades hearts'.split()

def define_suit(card):
	return SUITS[ord(card[-1]) % 7]


define_suit = lambda card: {'C': 'clubs', 'S': 'spades', 'D': 'diamonds', 'H': 'hearts'}[card[-1]]


def define_suit(card: str) -> str:
	return {'c': 'clubs', 'd': 'diamonds', 'h': 'hearts', 's': 'spades'}.get(card[-1].lower())


def define_suit(card):
	return 'clubs' if 'C' in card else 'spades' if 'S' in card else 'diamonds' if 'D' in card else 'hearts'


def define_suit(card):
	return ['clubs', 'spades', 'diamonds', 'hearts'][('S' in card) + 2 * ('D' in card) + 3 * ('H' in card)]


define_suit = lambda x: {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}[x[-1:]]


def define_suit(card):
	DECK = ['2S', '3S', '4S', '5S', '6S', '7S', '8S', '9S', '10S', 'JS', 'QS', 'KS', 'AS', '2D', '3D', '4D', '5D', '6D', '7D', '8D', '9D', '10D', 'JD', 'QD', 'KD', 'AD', '2H', '3H', '4H', '5H', '6H', '7H', '8H', '9H', '10H', 'JH', 'QH', 'KH', 'AH', '2C', '3C', '4C', '5C', '6C', '7C', '8C', '9C', '10C', 'JC', 'QC', 'KC', 'AC']
	if card[-1] == 'S':
		return 'spades'
	elif card[-1] == 'C':
		return 'clubs'
	elif card[-1] == 'D':
		return 'diamonds'
	else:
		return 'hearts'


def define_suit(card):
	for letter in card:
		if letter.upper() == 'C':
			return 'clubs'
		elif letter.upper() == 'S':
			return 'spades'
		elif letter.upper() == 'D':
			return 'diamonds'
		elif letter.upper() == 'H':
			return 'hearts'


def define_suit(card):
	suits = {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}
	if card[-1] not in suits:
		pass
	return suits[card[-1]]


def define_suit(card):
	for i in card:
		if 'S' in card:
			return 'spades'
		elif 'D' in card:
			return 'diamonds'
		elif 'H' in card:
			return 'hearts'
		elif 'C' in card:
			return 'clubs'


def define_suit(card):
	if len(card) == 2:
		if card[1] == 'C':
			return 'clubs'
		elif card[1] == 'D':
			return 'diamonds'
		elif card[1] == 'H':
			return 'hearts'
		elif card[1] == 'S':
			return 'spades'
	elif card[2] == 'C':
		return 'clubs'
	elif card[2] == 'D':
		return 'diamonds'
	elif card[2] == 'H':
		return 'hearts'
	elif card[2] == 'S':
		return 'spades'


def define_suit(card):
	letter = card[-1]
	if letter == 'C':
		return 'clubs'
	elif letter == 'S':
		return 'spades'
	elif letter == 'D':
		return 'diamonds'
	else:
		return 'hearts'


def define_suit(card):
	return 'clubs' if card.endswith('C') == True else 'diamonds' if card.endswith('D') == True else 'hearts' if card.endswith('H') == True else 'spades'


def define_suit(card):
	suite = card[-1]
	if card[-1] == 'S':
		return 'spades'
	elif card[-1] == 'D':
		return 'diamonds'
	elif card[-1] == 'H':
		return 'hearts'
	else:
		return 'clubs'


def define_suit(card):
	return 'clubs' if card[-1] == 'C' else 'spades' if card[-1] == 'S' else 'diamonds' if card[-1] == 'D' else 'hearts' if card[-1] == 'H' else None


def define_suit(card):
	dicc = {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}
	return dicc[card[-1:].upper()]


def define_suit(card):
	a = {'C': 'clubs', 'S': 'spades', 'D': 'diamonds', 'H': 'hearts'}
	if card[-1] in a:
		return a[card[-1]]


def define_suit(card):
	if card[-1] == 'C':
		return 'clubs'
	if card[-1] == 'S':
		return 'spades'
	if card[-1] == 'D':
		return 'diamonds'
	return 'hearts'


def define_suit(card: str) -> str:
	return 'clubs' if 'C' in card else 'diamonds' if 'D' in card else 'hearts' if 'H' in card else 'spades'


def define_suit(card):
	if 'S' in card:
		return 'spades'
	elif 'C' in card:
		return 'clubs'
	elif 'H' in card:
		return 'hearts'
	else:
		return 'diamonds'


def define_suit(card):
	print(card)
	return ('clubs', 'spades', 'diamonds', 'hearts')['CSDH'.index(card[-1])]


def define_suit(cards):
	return 'clubs' if 'C' in cards else 'diamonds' if 'D' in cards else 'hearts' if 'H' in cards else 'spades'


def define_suit(card):
	c = card[-1]
	if c == 'C':
		return 'clubs'
	elif c == 'D':
		return 'diamonds'
	elif c == 'H':
		return 'hearts'
	else:
		return 'spades'


def define_suit(card):
	ls = [char for char in card]
	if ls[-1] == 'C':
		return 'clubs'
	elif ls[-1] == 'D':
		return 'diamonds'
	elif ls[-1] == 'H':
		return 'hearts'
	else:
		return 'spades'


def define_suit(card):
	return {'C': 'clubs', 'S': 'spades', 'D': 'diamonds', 'H': 'hearts'}.setdefault(card[-1], None)


def define_suit(card):
	if card[-1] is 'C':
		return 'clubs'
	elif card[-1] is 'S':
		return 'spades'
	elif card[-1] is 'D':
		return 'diamonds'
	elif card[-1] is 'H':
		return 'hearts'


def define_suit(card):
	SUITS = ['clubs', 'diamonds', 'hearts', 'spades']
	for i in SUITS:
		if card[-1] == str.upper(i[0]):
			return i


def define_suit(card):
	if card.endswith('C'):
		return 'clubs'
	elif card.endswith('S'):
		return 'spades'
	elif card.endswith('H'):
		return 'hearts'
	elif card.endswith('D'):
		return 'diamonds'


def define_suit(card):
	what = {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}
	for (k, v) in list(what.items()):
		if k in card:
			return v


def define_suit(c):
	return {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}.get(c[-1])


def define_suit(card):
	d = {'S': 'spades', 'D': 'diamonds', 'H': 'hearts', 'C': 'clubs'}
	return d[card[1]] if len(card) < 3 else d[card[2]]


def define_suit(card):
	for elem in card:
		if 'S' in card:
			return 'spades'
		elif 'D' in card:
			return 'diamonds'
		elif 'H' in card:
			return 'hearts'
		else:
			return 'clubs'


value = {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}

def define_suit(card):
	if card[-1] in value:
		return value.get(card[-1])


import re

def define_suit(card):
	if re.search('D\\Z', card):
		return 'diamonds'
	if re.search('C\\Z', card):
		return 'clubs'
	if re.search('H\\Z', card):
		return 'hearts'
	if re.search('S\\Z', card):
		return 'spades'


def define_suit(card):
	suits = {'C': 'clubs', 'D': 'diamonds', 'H': 'hearts', 'S': 'spades'}
	last_char = card[-1]
	return suits[last_char]


def define_suit(card):
	for each in card:
		if each[-1] == 'C':
			return 'clubs'
		elif each[-1] == 'D':
			return 'diamonds'
		elif each[-1] == 'H':
			return 'hearts'
		elif each[-1] == 'S':
			return 'spades'


def define_suit(card):
	return ('clubs', 'spades', 'diamonds', 'hearts')[{'C': 0, 'S': 1, 'D': 2, 'H': 3}.get(card[-1])]


def define_suit(card):
	card = card.lower()
	if 'c' in card:
		return 'clubs'
	elif 'd' in card:
		return 'diamonds'
	elif 'h' in card:
		return 'hearts'
	elif 's' in card:
		return 'spades'


def define_suit(c):
	return 'clubs' if c[-1] == 'C' else 'spades' if c[-1] == 'S' else 'hearts' if c[-1] == 'H' else 'diamonds'