Skip to content

Latest commit

 

History

History
44 lines (23 loc) · 823 Bytes

Colour_Association.md

File metadata and controls

44 lines (23 loc) · 823 Bytes

CodeWars Python Solutions


Colour Association

Colour plays an important role in our lifes. Most of us like this colour better then another. User experience specialists believe that certain colours have certain psychological meanings for us.

You are given a 2D array, composed of a colour and its 'common' association in each array element. The function you will write needs to return the colour as 'key' and association as its 'value'.

For example :

var array = [["white", "goodness"], ...] returns [{'white': 'goodness'}, ...]

Given Code

def colour_association(arr):
    pass

Solution

def colour_association(arr):
    return [{i[0]: i[1]} for i in arr]

See on CodeWars.com