You will be given an array of numbers.

For each number in the array you will need to create an object. 

The object key will be the number, as a string. The value will be the corresponding character code, as a string.

Return an array of the resulting objects.

All inputs will be arrays of numbers. All character codes are valid lower case letters. The input array will not be empty.

Source: codewars | Difficulty: EASY
Tags: String algorithms

Fundamentals

Data structures

Starter code: def num_obj(s):
	

Solutions:
def num_obj(s):
	return [{str(i): chr(i)} for i in s]


def num_obj(s):
	return [{str(n): chr(n)} for n in s]


def num_obj(s):
	return [{str(nb): chr(nb)} for nb in s]


def num_obj(s):
	return [{str(a): chr(a)} for a in s]


def num_obj(s):
	return [{str(c): chr(c)} for c in s]


def num_obj(s):
	return [{str(x): chr(x)} for x in s]


def num_obj(s):
	return [{str(d): chr(d)} for d in s]


def num_obj(s):
	objects = []
	for i in s:
		objects.append({str(i): chr(i)})
	return objects


num_obj = lambda a: [{str(n): chr(n)} for n in a]


def num_obj(lst):
	return [{str(n): chr(n)} for n in lst]