Build an RPG Character - Build an RPG Character

Tell us what’s happening:

guys i need your help
all my stats are not passing
what am i doing wrong
ps i am a novice

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(character_name, strength, intelligence, charisma):
    if not isinstance (character_name, str):
        return 'The character name should be a string'
    if character_name == '':
        return 'The character should have a name'
    if len(character_name) > 10:
        return 'The character name is too long'
    if '' in character_name:
        return 'The character name should not contain spaces'

    stats = [strength, intelligence, charisma]

    if not all (isinstance(stats, int) for stat in stats):
        return 'All stats should be integers'
    if not all(stat >= 1 for stat in stats):
        return 'All stats should be no less than 1'
    if not all(stat < 4 for stat in stats):
        return 'All stats should be no more than 4'
    if sum(stats) != 7:
        return 'The character should start with 7 points'
    def format_stat(label, value):
        return f"{label} " + "●" * value + "○" * (10 - value)

    return (
        f'{name}\n'
        f'{format_stat("STR", strength)}\n'
        f'{format_stat("INT", intelligence)}\n'
        f'{format_stat("CHA", charisma)}'
    )
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

Challenge Information:

Build an RPG Character - Build an RPG Character

Double-check this if statement. Is it saying, “if space not in character_name”?

There should be no space between a function and the parentheses used to call it.

Did you write this code yourself?

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

the statement is saying if space in character name return the character name should not contain spaces

no i didn’t write the validation for stats myself

does it?
test it
print('' in "an apple") what should it print? what does it print?
and print('' in "apple") what should it print? what does it print?

is your choice of condition a good choice?

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