Build an RPG Character - Build an RPG Character

Tell us what’s happening:

For some reason my code is not passing test 2-4 or 6-10. However, when I test it on my own with the print function, I return the correct result for all tests.

I am wondering does the lab environment requires specific solutions in order to pass the test?

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(character_name, STR, INT, CHA):
    if not isinstance(character_name, str):
        return 'The character name should be a string.'
    elif not character_name:
        return 'The character should have a name.'
    elif len(character_name) > 10:
        return 'The character name is too long.'
    elif ' ' in character_name:
        return 'The character name should not contain spaces.'
    if type(STR)!= int or type(INT) != int or type(CHA) != int:
        return 'All stats should be integers.'
    elif STR < 1 or INT < 1 or CHA < 1:
        return "All stats should be no less than 1."
    elif STR > 4 or INT > 4 or CHA > 4:
        return 'All stats should be no more than 4.'
    elif (STR + INT + CHA) != 7:
        return 'The character should start with 7 points.'
    else:
        strength_stat = '\nSTR ' + (full_dot * STR) + (empty_dot * (10-STR))
        intelligence_stat ='\nINT ' + (full_dot * INT) + (empty_dot * (10-INT))
        charisma_stat = '\nCHA ' + (full_dot * CHA) + (empty_dot * (10-CHA))

        return (character_name  + strength_stat  + intelligence_stat + charisma_stat
        )


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/144.0.0.0 Safari/537.36 Edg/144.0.0.0

Challenge Information:

Build an RPG Character - Build an RPG Character

charefully look at the strings you need to return, compare them to the ones you are returning one character at a time

1 Like

Thank you, I assumed the periods would be included in the statements. I’ll read more carefully next time.