Take a string and return a hash with all the ascii values of the characters in the string.
Returns nil if the string is empty.
The key is the character, and the value is the ascii value of the character.
Repeated characters are to be ignored and non-alphebetic characters as well.

Source: codewars | Difficulty: EASY
Tags: Fundamentals

Starter code: def char_to_ascii(string):
	

Solutions:
def char_to_ascii(string):
	return {c: ord(c) for c in set(string) if c.isalpha()} if len(string) else None


def char_to_ascii(s):
	if s:
		return {c: ord(c) for c in set(s) if c.isalpha()}


char_to_ascii = lambda s: {e: ord(e) for e in set(s) if e.isalpha()} or None


def char_to_ascii(string):
	return {c: ord(c) for c in string if c.isalpha()} or None


def char_to_ascii(stg):
	return {c: ord(c) for c in set(stg) if c.isalpha()} if stg else None


char_to_ascii = lambda s: None if len(s) == 0 else {c: ord(c) for c in s if c.isalpha()}


def char_to_ascii(string):
	return {x: ord(x) for x in set(string) if x.isalpha()} or None


def char_to_ascii(s):
	return {ch: ord(ch) for ch in set(s) if ch.isalpha()} if s else None