Build an RPG Character - Build an RPG Character

Tell us what’s happening:

I am stuck in steps 11 and 12. create_character(‘ren’, 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.
The code is working, I don’t have any errors showing and the wanted response is displayed in the terminal, but when I submit it it tells me it’s wrong.
Could someone tell me where the error is?

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(name, strenght, intelligence, charisma):
    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 name.count(' ') > 0:
        return('The character name should not contain spaces')
    elif not isinstance(strenght, int) or not isinstance(intelligence, int) or not isinstance(charisma, int):
        return('All stats should be integers')
    elif strenght < 1 or intelligence < 1 or charisma < 1:
        return('All stats should be no less than 1')
    elif strenght > 4 or intelligence > 4 or charisma > 4:
        return('All stats should be no more than 4')
    elif strenght + intelligence + charisma != 7:
        return('The character should start with 7 points')
    else:
        character_string=name
        character_string += f'\nSTR {full_dot*strenght}{empty_dot*(10-strenght)} \nINT {full_dot*intelligence}{empty_dot*(10-intelligence)} \nCHA {full_dot*charisma}{empty_dot*(10-charisma)}'
        return(character_string) 

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/145.0.0.0 Safari/537.36

Challenge Information:

Build an RPG Character - Build an RPG Character

1 Like
print('Actual:   ',repr(create_character('ren', 4, 2, 1))) 
print('Expected: ',repr('ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○'))

Test like this to compare actual to expected.