Build an RPG Character - Build an RPG Character

Tell us what’s happening:

step 10:
When create_character is called with a second, third or fourth argument that is not an integer it should return All stats should be integers
will not pass but all other tests pass, unsure what is wrong

Your code so far

full_dot = '●'
empty_dot = '○'
def create_character(character_name,strength,intelligence,charisma):
    if not isinstance(character_name,str):
        return 'The character name should be a string'
    if character_name=='':
        return'The character should have a name'
    if len(character_name)>=11:
        return 'The character name is too long'
    if ' ' in character_name:
            return'The character name should not contain spaces'
    stats={'STR':strength,'INT':intelligence,'CHA':charisma}
    for stat in stats.values():
        if not isinstance(stat,int):
            return'All stats should be integers'
        if stat<=0:
            return 'All stats should be no less than 1'
        if stat>=5:
            return 'All stats should be no more than 4'
        if sum(stats.values())!=7:
            return 'The character should start with 7 points'
        
    character_string=character_name
    for key, stat in stats.items():
        character_string+=f'\n{key} {full_dot*stat}{empty_dot*(10-stat)}'
    return character_string

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.6 Safari/605.1.15

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 @b_ellis,

Should this code be inside your for…in loop?

Happy coding

thank you so much! I can’t believe it was that simple!