Build an RPG character - Build an RPG Character

Tell us what’s happening:

I am failing step 11 and 12. I have tried my best with then but still no luck

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(name, strength, intelligence, charisma):
    if not isinstance(name, str):
        return "The character name should be a string"
    
    if len(name) > 10:
        return "The character name is too long"
    
    if " " in name:
        return "The character name should not contain spaces"

    stats = {'STR': strength, 'INT': intelligence, 'CHA': charisma}

    # Check all stats are integers
    if not all(isinstance(s, int) for s in stats.values()):
        return "All stats should be integers"

    # Check each stat between 1–4
    if any(s < 1 for s in stats.values()):
        return "All stats should be no less than 1"

    if any(s > 4 for s in stats.values()):
        return "All stats should be no more than 4"

    # Check sum equals 7
    if sum(stats.values()) != 7:
        return "The character should start with 7 points"

    output = name +  "\n"
    for key in ['STR','INT', 'CHA']:
        value = stats[key]
        bar = full_dot * value + empty_dot*(10-value)
        output+= f"{key} {bar}\n" 
    return output

print(create_character('ren', 4, 2, 1))


Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36

Challenge Information:

Build an RPG character - Build an RPG Character

If you wrap the function call in repr function, there will be printed string representation that’s easier to compare directly with the expected one. Ie:

print(repr(create_character('ren', 4, 2, 1)))