Build an RPG Character - Build an RPG Character

Tell us what’s happening:

i need help for lab 7 i have done everything but nothing happening

Your code so far

full_dot = '●'
empty_dot = '○'

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

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

Have you tried testing your function by calling it and printing the result?

try adding print(create_character("ren", 4, 2, 1)) what get printed?

You haven’t written any code to address Test #7, so how can you possibly pass that test?

i wrote the code but that did’t work so deleted it

Tell us what’s happening:

can anyone tell me what im doing wrong plzzz help

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(name,strength,intelligence,charisma):
    if not isinstance(name, str):
        return "The character name should be a string"
    if len(name)==0 :
        return "The character should have a name"
    if len(name)>10:
        return "The character name is too long"
    if "" in name:
        return "The character name should not contain spaces"
    if not isinstance(strength, int) and not isinstance(intelligence, int) and not isinstance(charisma, int):
        return "All stats should be integers"

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

Please don’t create duplicate topics for the same challenge/step. I have merged your post into this existing topic.

Look at the validation just before “stats should be integers”. Is this really checking for a space in character name?

i’m sorry about that i didn’t mean to

No worries…happy coding. :slight_smile:

what you mean by that and more over i’m stuck in this for 3 days

Is that a space in your if statement?

yes there is but that is from lab 6 and that give me a check that what i did is right but what i can’t pass is lab7

i’m not able to solve this i have done everything

7. When create_character is called with a second, third or fourth argument that is not an integer it should return All stats should be integers.

I don’t see a space between the quotes! And, to quote pkdvalis:

"The tests are simple tests, and cannot account for every variation they encounter. Do not try to code based only on the tests.

If a test is failing you need to check that the User Stories are implemented correctly."

bro can i ask you something the code you pointed it out ( if “” in name: )

i put space between the quotes and lad 7 is completed now, can you tell how a space between quotes were interfering

Test your code with the “space” error:

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

What do you see in the console? Processing stopped before your code ever reached the “stats should be integers” validation.

1 Like