Build an RPG Character - Build an RPG Character

Tell us what’s happening:

Step 18 tells me that “create_character(‘ren’, 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○” when my code return the RIGHT THING. I’m going insane trying to find out what’s wrong. I litterally get this when I run my code:
ren
STR: ●●●●○○○○○○
INT: ●●○○○○○○○○
CHA: ●○○○○○○○○○

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(name,strength,intelligence, stamina):
    if type(name) != str:
        return 'The character name should be a string'
    elif name == '':
        return 'The character should have a name'
    elif len(name) > 10:
        return 'The character name is too long'
    elif name.find(' ') > 0:
        return 'The character name should not contain spaces'
    elif (type(strength)!=int or type(intelligence)!=int or type(stamina)!=int):
        return 'All stats should be integers'
    elif strength < 1 or intelligence < 1 or stamina <1:
        return 'All stats should be no less than 1'
    elif strength > 4 or intelligence > 4 or stamina > 4:
        return 'All stats should be no more than 4'
    elif strength + stamina + intelligence != 7:
        return 'The character should start with 7 points'
    else:
        return f'{name}\nSTR: {full_dot*strength}{empty_dot*(10-strength)}\nINT: {full_dot*intelligence}{empty_dot*(10-intelligence)}\nCHA: {full_dot*stamina}{empty_dot*(10-stamina)}'

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


Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:147.0) Gecko/20100101 Firefox/147.0

Challenge Information:

Build an RPG Character - Build an RPG Character

Hi @coquille.st.jacqu, and welcome to the FCC community!

This may seem pedantic, and your code is technically right, but it doesn’t follow the story. There are colons in front of STR, INT, and CHA that shouldn’t be there.

Fix that, and you won’t take an arrow to the knee…maybe.

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.