Build an RPG character - Build an RPG Character

Tell us what’s happening:

i am strugling with step 10. when i do it in pycharm it all works fine no problem exactly as asked but in here it says step 10 isn’t done

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(name, strength, intelligence, charisma):
    # name has to be string
    if not isinstance(name, str):
        return 'The character name should be a string'
    # name not longer than 10 characters
    if len(name) >= 10:
        return 'The character name is too long'
    # no space in name
    if ' ' in name:
        return 'The character name should not contain spaces'

    stats = [strength, intelligence, charisma]
    if not all(isinstance(s,int) for s in stats):
        return 'All stats should be integers'
    if any(s < 1 for s in stats):
        return 'All stats should be no less than 1'
    if any(s > 4 for s in stats):
        return 'All stats should be no more than 4'
    if sum(stats) != 7:
        return 'The character should start with 7 points'

    def makebar(value):
        return  full_dot * value + empty_dot *(10-value)


    result = f'{name}\nSTR {makebar(strength)}\nINT {makebar(intelligence)}\nCHA {makebar(charisma)}'
    
    return result

(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/140.0.0.0 Safari/537.36 OPR/124.0.0.0

Challenge Information:

Build an RPG character - Build an RPG Character

please review user story 3 really carefully

1 Like

The instructions say that the length of name must not exceed 10, but it can be 10.