It's Friday night, and Chuck is bored. He's already run 1,000 miles, stopping only to eat a family sized bag of Heatwave Doritos and a large fistful of M&Ms. He just can't stop thinking about kicking something! 

There is only one thing for it, Chuck heads down to his local MMA gym and immediately challenges every fighter there to get in the cage and try and take him down... AT THE SAME TIME! 

You are provided an array of strings that represent the cage and Chuck's opponents. Your task, in traditional Chuck style, is to take their heads off!! Throw punches, kicks, headbutts (or more likely - regex or iteration...) but whatever you do, remove their heads. Return the same array of strings, but with the heads ('O') removed and replaced with a space (' ').

If the provided array is empty, or is an empty string, return 'Gym is empty'. If you are given an array of numbers, return 'This isn't the gym!!'.

FIGHT!!

*Original design of this kata was a much more beautiful thing - the test cases illustrate the idea, and the intended output. I am unable to make the actual output go over multiple lines so for now at least you will have to imagine the beauty!*

Difficulty: introductory

Starter code:

def head_smash(arr):
	

Solutions:
def head_smash(arr):
    try:
        return [a.replace('O', ' ') for a in arr] or 'Gym is empty'
    except TypeError:
        return "This isn't the gym!!"


def head_smash(arr):
    try:
        return [x.replace('O', ' ') for x in arr] or 'Gym is empty'
    except:
        return 'This isn\'t the gym!!'

def head_smash(arr):
    if isinstance(arr, int):
        return "This isn't the gym!!"
    return [line.replace("O", " ") for line in arr] if arr else "Gym is empty"

import re
def head_smash(arr):
    try:
        return [re.sub('O',' ',i) for i in arr] if arr else 'Gym is empty'
    except:
        return 'This isn\'t the gym!!'

def head_smash(arr):
    if not arr:
        return 'Gym is empty'
    if isinstance(arr, int):
        return "This isn't the gym!!"
    return [l.replace('O', ' ') for l in arr]

def head_smash(arr):
    if isinstance(arr, int) is True:
        return "This isn\'t the gym!!"

    elif arr == [] or arr == '':
        return 'Gym is empty'
    
    else:
        d = [x.replace('O', ' ') for x in arr]
        return d

def head_smash(arr):
    if not arr:
        return 'Gym is empty'
    if not isinstance(arr, list) \
        or not all(isinstance(l, str) for l in arr):
            return "This isn't the gym!!"
    return [l.replace('O', ' ') for l in arr]

def head_smash(a):
    if type(a) == int: return "This isn't the gym!!"
    if not a: return "Gym is empty"
    return [s.replace('O',' ') for s in a]

def head_smash(arr):
    if not arr:return "Gym is empty"
    if not isinstance(arr,list):return "This isn't the gym!!"
    return list(map(lambda x:x.replace("O"," "),arr))

def head_smash(arr):
    if arr == [] or arr=="":
        return "Gym is empty"
    if isinstance(arr, int):
        return "This isn't the gym!!"
    res = []
    for i in arr:
        res.append(i.replace("O", " "))
    return res