Build an RPG Character - Build an RPG Character

Tell us what’s happening:

Can’t pass 17 and 18. Please tell me what’s wrong with my code

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 name=='':
        return 'The character should have a name'
    if len(name)>10:
        return 'The character name is too long'
    if ' ' in name:
        return 'The character name should not contain spaces'
    for stat in (strength,intelligence, charisma):
        if not isinstance (stat,int):
            return 'All stats should be integers'
    for stat in (strength,intelligence, charisma):    
        if stat<1:
            return 'All stats should be no less than 1'
    for stat in (strength,intelligence, charisma):        
        if stat>4:
            return 'All stats should be no more than 4' 
    if strength+intelligence+charisma!=7:
        return 'The character should start with 7 points'
def create_dots(stat):
    return stat*full_dot+(10-stat)*empty_dot

    return (
        f'{name}\n'
        f'STR{create_dots(strength)}\n'
        f'INT{create_dots(intelligence)}\n'
        f'CHA{create_dots(charisma)}'
    )

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36

Challenge Information:

Build an RPG Character - Build an RPG Character

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-rpg-character/67d83df6f82eda3868dd2a84.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @lingding

To help you debug add the following print call at the bottom of the editor.

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

Happy coding