Ahoy Matey!

Welcome to the seven seas.

You are the captain of a pirate ship.

You are in battle against the royal navy.

You have cannons at the ready.... or are they?

Your task is to check if the gunners are loaded and ready, if they are: ```Fire!```

If they aren't ready: ```Shiver me timbers!```

Your gunners for each test case are 4 or less.

When you check if they are ready their answers are in a dictionary and will either be: ```aye``` or ```nay```

Firing with less than all gunners ready is non-optimum (this is not fire at will, this is fire by the captain's orders or walk the plank, dirty sea-dog!)

If all answers are 'aye' then Fire!
if one or more are 'nay' then Shiver me timbers!

Also, check out the new Pirates!! Kata:
https://www.codewars.com/kata/57e2d5f473aa6a476b0000fe

Difficulty: introductory

Starter code:

def cannons_ready(gunners):
	

Solutions:
def cannons_ready(gunners):
  return 'Shiver me timbers!' if 'nay' in gunners.values() else 'Fire!'

def cannons_ready(gunners):
    for i in gunners:
        if gunners[i] == 'nay':
            return 'Shiver me timbers!'
    return 'Fire!'

def cannons_ready(g):
  return ['Fire!','Shiver me timbers!']['nay' in g.values()]

def cannons_ready(gunners):
  return 'Fire!' if all(map(lambda x: x=='aye', gunners.values())) else 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if all(x == 'aye' for x in gunners.values()) else 'Shiver me timbers!'

from collections import Counter
def cannons_ready(gunners):
   return ["Fire!","Shiver me timbers!"][len(Counter(list(gunners.values()))) !=1]


cannons_ready = lambda g: "Shiver me timbers!" if "nay" in g.values() else "Fire!"

def cannons_ready(gunners):
    return ('Fire!' if all(answer == 'aye' for answer in gunners.values())
        else 'Shiver me timbers!')

def cannons_ready(gunners):
    return "Fire!" if all(s == "aye" for _, s in gunners.items()) else "Shiver me timbers!"

def cannons_ready(gunners):
  return 'Shiver me timbers!' if any(x == 'nay' for x in gunners.values()) else 'Fire!'  

def cannons_ready(gunners):
  # Fire! or Shiver me timbers!
  if 'nay' not in list(gunners.values()):
      return 'Fire!'
  return 'Shiver me timbers!'  


def cannons_ready(gunners):
  return all(x == 'aye' for x in gunners.values()) and 'Fire!' or 'Shiver me timbers!'

def cannons_ready(gunners):
  return 'Fire!' if all(v=='aye' for v in gunners.values()) else 'Shiver me timbers!'

from typing import Dict

def cannons_ready(gunners: Dict[str, str]) -> str:
    """ If all answers from gunners are 'aye' then `Fire!` if one or more are 'nay' then `Shiver me timbers!` """
    gunners_orders = {
        True: "Fire!",
        False: "Shiver me timbers!"
    }
    return gunners_orders.get(len(list(filter(lambda _: _ == "aye", gunners.values()))) == len(gunners))

def cannons_ready(gunners):
    values = list(gunners.values())
    count = 0
    for i in values:
        if i == 'nay':
            count += 1
        else:
            count += 0
    if count > 0:
        return 'Shiver me timbers!'
    return 'Fire!'
    


def cannons_ready(gunners):
  return next(('Shiver me timbers!' for x in gunners.values() if x == 'nay'), 'Fire!')

def cannons_ready(g):
    return ['Shiver me timbers!', 'Fire!'][all(i=='aye' for i in g.values())]

cannons_ready = lambda gunners: "Shiver me timbers!" if "nay" in gunners.values() else "Fire!"

def cannons_ready(reply):
    xx=[x for x in reply.values()].count('aye')
    if xx == len(reply): return 'Fire!'
    else: return 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if all('aye' == el for el in gunners.values()) else 'Shiver me timbers!'

def cannons_ready(gunners):
    print(gunners)
    for i in gunners:
        if gunners[i] == "nay":
            return 'Shiver me timbers!'
            break
    else:
        return "Fire!"


def cannons_ready(gunners):
    return 'Shiver me timbers!' if 'nay' in list(gunners[i] for i in gunners) else 'Fire!'

def cannons_ready(gunners):    
    fire = True
    for gunner, response in gunners.items():
        if response == 'nay':
            fire = False
    return 'Fire!' if fire == True else 'Shiver me timbers!'

def cannons_ready(gunners):
    for i in gunners:
        if gunners[i] == 'nay':
            return 'Shiver me timbers!'
    else: return 'Fire!'

def cannons_ready(gunners):
    all = []
    yes = []
    no = []
    for key in gunners:
        all.append(gunners[key])
    for i in all:
        if i == 'aye':
            yes.append(i)
        if i == 'nay':
            no.append(i)
    if len(no) == 0: return 'Fire!'
    else: return 'Shiver me timbers!'
    
    
'''If all answers are 'aye' then Fire! if one or more are 'nay' then Shiver me timbers!'''

def cannons_ready(gunners):
    return 'Shiver me timbers!' if 'nay' in [v for k,v in list(gunners.items())] else 'Fire!'


def cannons_ready(gunners):
    for k in gunners.values():
        if k == "nay":
            return "Shiver me timbers!"
    return "Fire!"

def cannons_ready(g):
    x="Fire!"
    y="Shiver me timbers!"
    
    for b in g.values():
        if b=='nay':
            return y
    return x

def cannons_ready(gunners):
    for ready in gunners.values():
        if ready == 'nay':
            return 'Shiver me timbers!'
    
    return 'Fire!'

cannons_ready = lambda g: 'Fire!' if len(g) == tuple(g.values()).count('aye') else 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if not 'nay' in [gunners[i] for i in gunners] else 'Shiver me timbers!'

def cannons_ready(g):
    return "Shiver me timbers!" if any(g[x] == "nay" for x in g) else "Fire!"

from typing import Dict

def cannons_ready(gunners: Dict[str,str]) -> str:
    """Returns fire if all gunners are ready else shiver me timbers."""
    ready = not 'nay' in gunners.values()
    return 'Fire!' if ready else 'Shiver me timbers!'

def cannons_ready(gunners):
    if len(list(gunners.values())) <= list(gunners.values()).count('aye'):
        return 'Fire!'
    else:
        return 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if all(map(lambda x: x[1]=='aye', gunners.items())) else 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if list(gunners.values()).count('aye') == len(list(gunners.values())) else 'Shiver me timbers!'

def cannons_ready(gunners):
    if all(a == 'aye' for a in gunners.values()):
        return 'Fire!'
    else:
        return 'Shiver me timbers!'

def cannons_ready(gunners):
    if any([x for x in list(gunners.values()) if x!='aye']):
           return 'Shiver me timbers!'
    else:
           return 'Fire!'
  # Fire! or Shiver me timbers!


def cannons_ready(gunners):
    
    g = gunners
    
    aye = [g[i] for i in g if g[i] == 'aye']
    nay = [g[i] for i in g if g[i] == 'nay']
    
    if len(nay) >= 1:
        return 'Shiver me timbers!'
    else:
        return 'Fire!'

def cannons_ready(gunners):
    if len(set(gunners.values())) == 1:
        return 'Fire!'
    return 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if all(['aye' == v for v in gunners.values()]) else 'Shiver me timbers!'

def cannons_ready(gunners):
    c=0
    for i in gunners:
        if gunners.get(i)=="nay":
            c=1
            break
    if c==1:
        return "Shiver me timbers!"
    else:
        return "Fire!"

def cannons_ready(gunners):
    for d in list(gunners.values()):
        if d !='aye':
            return 'Shiver me timbers!'
    return 'Fire!'
  # Fire! or Shiver me timbers!


def cannons_ready(gunners):
    fire = {v: k for k, v in gunners.items()}
    z = fire.get('nay')
    return 'Fire!'if not z else 'Shiver me timbers!'

def cannons_ready(a):
    if "nay" in [i for i in a.values()] : return "Shiver me timbers!"
    return "Fire!"

def cannons_ready(gunners):
    if gunners and all(v == 'aye' for v in gunners.values()):
        return 'Fire!'
    else:
        return 'Shiver me timbers!'

def cannons_ready(gunners):
    flag = 0
    for value in list(gunners.values()):
        if value == 'aye':
            flag += 1
            
    return 'Fire!' if flag == len(gunners) else 'Shiver me timbers!'


def cannons_ready(gunners):
    for person, say in gunners.items():
        if say == 'nay':
            return 'Shiver me timbers!'
    return 'Fire!'

def cannons_ready(g):
    return 'Fire!' if all(g[i] == 'aye' for i in g) else  'Shiver me timbers!'

def cannons_ready(gunners):
    return ['Fire!','Shiver me timbers!']['nay' in list(gunners.values())] 
#     return 'Shiver me timbers!' if 'nay' in gunners.values() else 'Fire!'


def cannons_ready(gunners):
    shoot = True
    for g in list(gunners.values()):
        if g == 'nay':
            shoot = False
    if shoot:
        return "Fire!"
    else:
        return "Shiver me timbers!"


def cannons_ready(gunners):
    return 'Shiver me timbers!' if sum([1 for k, v in list(gunners.items()) if v =="nay"]) else 'Fire!'


def cannons_ready(gunners):
    l=[]
    for i in gunners:
        l.append(i)
    for i in l:
        if gunners.get(i)=="nay":
            return 'Shiver me timbers!'
    return "Fire!"

def cannons_ready(gunners):
  # Fire! or Shiver me timbers!
    if list(gunners.values()).count('nay') == 0:
        return 'Fire!'
    else:
        return 'Shiver me timbers!'

def cannons_ready(gunners):
    a = [v for v in gunners.values()]
    if "nay" in a:
        return "Shiver me timbers!"
    else:
        return "Fire!"

def cannons_ready(gunners):
    """
    Arg!
    """
    return 'Fire!' if set(gunners.values()) == {'aye'} else 'Shiver me timbers!'

def cannons_ready(gunners):

    yes_or_no = list()
    for v in gunners.values():
        yes_or_no.append(v)
    
    if "nay" in yes_or_no:
        return "Shiver me timbers!"
    else:
        return "Fire!"

def cannons_ready(g):
    for i in g.values():
        if i != 'aye':
            return 'Shiver me timbers!'
    return 'Fire!'

def cannons_ready(gunners):
    if all(x == "aye" for x in gunners.values()):
        return "Fire!"
    if len(gunners) < 4:
        return "Shiver me timbers!"
    else:
        return "Fire!" if gunners["Mike"]== "aye" and gunners["Joe"] == "aye" and gunners["Johnson"] == "aye" and gunners["Peter"] == "aye" else "Shiver me timbers!"

def cannons_ready(gunners):
    msg = 'Fire!'
    if 'nay' in gunners.values():
        msg = 'Shiver me timbers!'
    return msg

def cannons_ready(gunners):
    nay_count = 0
    msg = 'Fire!'
    for k, v in gunners.items():
        if v == 'nay':
            nay_count += 1
    if nay_count:
        msg = 'Shiver me timbers!'
    return msg

def cannons_ready(gunners):
    fire = True
    for gunner in gunners:
        if gunners[gunner] == 'nay':
            fire = False
    return 'Fire!' if fire else 'Shiver me timbers!'

def cannons_ready(gunners):
    l = gunners.values()
    m = [i for i in l]
    x = m.count('aye')
    y = m.count('nay')
    return 'Fire!' if x == len(m) else 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if all(gun == 'aye' for gun in gunners.values()) else 'Shiver me timbers!'

def cannons_ready(gunners):
    if all([True if i == 'aye' else False for i in gunners.values()]) == True:
        return 'Fire!'
    return 'Shiver me timbers!'

def cannons_ready(gunners):
    temp = True        
    for i in gunners:
        if gunners[i] == 'nay':
            temp = False
    return 'Fire!' if temp else 'Shiver me timbers!'


def cannons_ready(gunners):
  return ['Shiver me timbers!', 'Fire!'][all(ans == 'aye' for ans in list(gunners.values()))]


def cannons_ready(gs):
  return 'Shiver me timbers!' if 'nay' in gs.values() else 'Fire!'

def cannons_ready(gunners):
  # Fire! or Shiver me timbers!
  print (gunners)
  if 'nay' in gunners.values():
      return 'Shiver me timbers!'
  else:
      return 'Fire!'

def cannons_ready(gunners):
    for k, v in gunners.items():
        if all(v == 'aye' for v in gunners.values()):
            return 'Fire!'
        elif v == 'nay':
            return 'Shiver me timbers!'

def cannons_ready(gunners):
    for name in gunners:
        if gunners.get(name) == 'nay':
            return "Shiver me timbers!"
    return "Fire!"
        


def cannons_ready(gunners):
  # Fire! or Shiver me timbers!
  if all(value == "aye" for value in gunners.values()):
      return "Fire!"
  else: 
      return "Shiver me timbers!"
      
      all(value == 0 for value in your_dict.values())

cannons_ready = lambda gunners: 'Fire!' if all(i == 'aye' for i in gunners.values()) else 'Shiver me timbers!'

def cannons_ready(gunners):
    for item in gunners:
        if gunners.get(item) == 'nay':
            return 'Shiver me timbers!'
    return 'Fire!'

def cannons_ready(gunners):
    result = 'Fire!'
    for gun in gunners:
        if gunners[gun] == 'nay':
            result = 'Shiver me timbers!'
            break
    return result


def cannons_ready(gunners):
    for answer in gunners:
        if gunners.get(answer) == 'nay':
            return 'Shiver me timbers!'
    return 'Fire!'


def cannons_ready(gunners):
  # Fire! or Shiver me timbers!
  if 'nay' in gunners.values():
      return 'Shiver me timbers!'
  else:
      return 'Fire!'
      
cannons_ready({'m':'a'})

def cannons_ready(gunners: dict):
    return 'Fire!' if all([v.lower() == 'aye' for v in gunners.values()]) else 'Shiver me timbers!'

def cannons_ready(gunners): 
  return 'Shiver me timbers!' if [value for value in gunners.values()].count('nay') >= 1 else 'Fire!'

def cannons_ready(gunners):
    if "nay" in list(gunners.values()):
        return "Shiver me timbers!"
    return "Fire!"




# def cannons_ready(gunners):
#   return 'Shiver me timbers!' if 'nay' in gunners.values() else 'Fire!'
  
  
  
#   def cannons_ready(gunners):
#     for i in gunners:
#         if gunners[i] == 'nay':
#             return 'Shiver me timbers!'
#     return 'Fire!'




def cannons_ready(gunners):
  return 'Fire!' if len(set(gunners.values())) <= 1 else 'Shiver me timbers!'


def cannons_ready(d):
    return 'Fire!' if len(set(d.values())) == 1 else 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if all(s == 'aye' for s in gunners.values()) else 'Shiver me timbers!'

def cannons_ready(gunners):
    gunners = list(gunners.values())
    
    
    if gunners.count("nay") >= 1:
        return 'Shiver me timbers!'
    else:
        return "Fire!"

def cannons_ready(gunners):
    if list(set(gunners.values())) == ['aye']:
        return 'Fire!'
    else:
        return 'Shiver me timbers!'

cannons_ready=lambda g:'Fire!' if all(x=='aye' for x in g.values()) else 'Shiver me timbers!'

def cannons_ready(g):
  return 'Fire!' if all(x=='aye' for x in g.values()) else 'Shiver me timbers!'

def cannons_ready(gunners):
    return 'Fire!' if len(gunners) == list(gunners.values()).count("aye") else 'Shiver me timbers!'

def cannons_ready(gunners):
  return 'Fire!' if all(gunners[each] == 'aye' for each in gunners) else 'Shiver me timbers!'

def cannons_ready(gunners):
    b = list(gunners.values())
    if 'nay' not in b:
        return 'Fire!'
    else:
        return 'Shiver me timbers!'


def cannons_ready(gunners):
    for gunner in gunners:
        if gunners.get(gunner) == 'nay':
            return 'Shiver me timbers!'
    return 'Fire!'

def cannons_ready(gunners):
  # Fire! or Shiver me timbers!
      if len(set(gunners.values())) >= 2:
        return 'Shiver me timbers!'
      return 'Fire!'

def cannons_ready(gunners):
  # Fire! or Shiver me timbers!
  return "Fire!" if sum(1 if gunners[i] == 'aye' else 0 for i in gunners) == len(gunners) else 'Shiver me timbers!'

def cannons_ready(gunners):
    gunners = list(gunners.values())
    if gunners.count("aye") == len(gunners):
        return("Fire!")
    if "nay" in gunners:
        return("Shiver me timbers!")


def cannons_ready(gunners):
  if all([ready is 'aye' for gunner, ready in gunners.items()]):
      return 'Fire!'
  
  return 'Shiver me timbers!'

def cannons_ready(gunners):
    for gunner in list(gunners.values()):
        if gunner is not 'aye':
            return 'Shiver me timbers!'
    return 'Fire!'

def cannons_ready(gunners):
    flag = True
    for key, value in gunners.items():
        if value == 'nay':
            flag = False
            pass
    return 'Fire!'if flag else 'Shiver me timbers!'

def cannons_ready(gunners):
    result = 0
    for i in gunners:
        if gunners[i] == 'nay':
            result+=1
    return 'Fire!' if result == 0 else 'Shiver me timbers!'