Santa is coming to town and he needs your help finding out who's been naughty or nice. You will be given an entire year of JSON data following this format:

Your function should return `"Naughty!"` or `"Nice!"` depending on the total number of occurrences in a given year (whichever one is greater). If both are equal, return `"Nice!"`

Difficulty: introductory

Starter code:

def naughty_or_nice(data):
	

Solutions:
def naughty_or_nice(data):
    nice = 0
    for month in data:
        for day in data[month]:
            nice += 1 if data[month][day] == "Nice" else -1
    return "Nice!" if nice >= 0 else "Naughty!"


import json

def naughty_or_nice(data):
    parsed_data = json.dumps(data)
    return "Nice!" if parsed_data.count("Nice") >= parsed_data.count("Naughty") else "Naughty!"

def naughty_or_nice(data):
    s = str(data)
    return 'Nice!' if s.count('Nice') >= s.count('Naughty') else 'Naughty!'

naughty_or_nice = lambda d:max(['Nice', 'Naughty'], key=[x for y in d.values() for x in y.values()].count) + '!'

import json
def naughty_or_nice(data):
    s = json.dumps(data)
    return 'Nice!' if s.count('Nice') >= s.count('Naughty') else 'Naughty!'

from collections import Counter

def naughty_or_nice(data):
    c = Counter(x for v in data.values() for x in v.values())
    return 'Nice!' if c['Nice'] >= c['Naughty'] else 'Naughty!'

def naughty_or_nice(data):
    return 'Nice!' if str(data).count('Nice') >= str(data).count('Naughty') else 'Naughty!'

def naughty_or_nice(data):
    return "Nice!" if sum(1 if day == "Nice" else -1 for month in data.values() for day in month.values()) >= 0 else "Naughty!"

def naughty_or_nice(data):
  nice_count = 0
  naughty_count = 0
  
  for month, days in data.items():
    for date, status in days.items():
      if status == 'Nice':
        nice_count += 1
      else:
        naughty_count += 1
  
  return 'Naughty!' if nice_count < naughty_count else 'Nice!'