Build an RPG Character - Build an RPG Character

Tell us what’s happening:

Task 19/18

Pretty sure my code is correct since i made my own personal tests but the site tests are asking for it in a different way is what I suspect. Not sure what i could be doing wrong here

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(NAME, STR, INT, CHAR):
    Str = empty_dot * 10
    Int = empty_dot * 10
    Char = empty_dot * 10
    
    if not isinstance(NAME, str):
        return 'The character name should be a string'
    elif not NAME:
        return 'The character should have a name'
    elif len(NAME) > 10:
        return 'The character name is too long'
    elif ' ' in NAME:
        return 'The character name should not contain spaces'
    elif not (isinstance((STR), int) and isinstance(INT, int) and isinstance(CHAR, int)):
        return 'All stats should be integers'
    elif (STR < 1 or INT < 1 or CHAR < 1):
        return 'All stats should be no less than 1'
    elif (STR > 4 or INT > 4 or CHAR > 4):
        return 'All stats should be no more than 4'
    elif (STR + INT + CHAR) != 7:
        return 'The character should start with 7 points'
    else:

      print(NAME)
      print('STR', Str[:STR].replace('○', '●') + Str[:-STR])
      print('INT',Int[:INT].replace('○', '●') + Int[:-INT])
      print('CHA',Char[:CHAR].replace('○', '●') + Char[:-CHAR])
    

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/150.0.0.0 Safari/537.36 OPR/134.0.0.0

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

Hi @penicillin

What does your function return?

Any reason not to use the two variables on lines 1 and 2?

Happy coding

image_2026-08-31_204627617

this is the output and I am using those two variables as seen on lines 5-8 which then connect to the last few lines.

you may want to review the difference between printing and returning

i get that and wondered about that too since the last task requires that ‘When create_character is called with valid values it should output the character stats as required.’ Which doesnt make sense if the function only uses return values. I did however try using return values for the last few lines eitherway and it still didnt work for task 18 nor 19

please post your updated code

also please note that the output of a function is its return value

Hi @penicillin

Try calling you function like this:

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

Happy coding