Apparently "Put A Pillow On Your Fridge Day is celebrated on the 29th of May each year, in Europe and the U.S. The day is all about prosperity, good fortune, and having bit of fun along the way."

All seems very weird to me.

Nevertheless, you will be given an array of two strings (s). First find out if the first string contains a fridge... (i've deemed this as being 'n', as it looks like it could hold something).

Then check that the second string has a pillow - deemed 'B' (struggled to get the obvious pillow-esque character).

If the pillow is on top of the fridge - it must be May 29th! Or a weird house... Return true; For clarity, on top means right on top, ie in the same index position.

If the pillow is anywhere else in the 'house', return false;

There may be multiple fridges, and multiple pillows. But you need at least 1 pillow ON TOP of a fridge to return true. Multiple pillows on fridges should return true also.

100 random tests

Difficulty: introductory

Starter code:

def pillow(s):
	

Solutions:
pillow=lambda s:('n','B')in zip(*s)

def pillow(s):
    return ('n','B') in zip(*s)

def pillow(arr):
    s1, s2 = arr
    return bool({i for i, a in enumerate(s1) if a == 'n'} &
                {i for i, b in enumerate(s2) if b == 'B'})

def pillow(s):
    return ('n', 'B') in zip(s[0],s[1])

def pillow(s):
    return any(i == ('n', 'B') for i in zip(*s))

def pillow(s):
  fridges = set(i for i, v in enumerate(s[0]) if v == 'n')
  pillows = set(i for i, v in enumerate(s[1]) if v == 'B')
  return len(fridges & pillows) > 0

def pillow(s):
    return next((True for a,b in zip(*s) if a=='n' and b=='B'), False)

def pillow(s):
    x=list(s[0])
    y=list(s[1])
    z=0
    while z<len(x):
        if x[z]=='n':
            if y[z]=='B': return True
        z+=1
    return False

def pillow(s):
    return any([l=='n' and r=='B' for l,r in zip(*s)])

def pillow(s):
    return bool([1 for fridge, pillow in zip(s[0], s[1]) if fridge == 'n' and pillow == 'B'])