RPG Character code fail

Tell us what’s happening:

I can’t get past test #11 on RPG Character Creation in the Python curriculum. Anyone care to give advice?

Your code so far:

full_dot = ‘●’

empty_dot = ‘○’

def create_character(name, strength, intel, charisma):

if not isinstance(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 " " in name:

    return "The character name should not contain spaces"

if not isinstance(name, int):

    return "All stats should be integers"

   \# elif isinstance(name, int):

        

elif not isinstance(strength, int):

    return "All stats should be integers"

  \#  elif isinstance(strength, int):

        

elif not isinstance(intel, int):

    return "All stats should be integers"

  \#  elif isinstance(intel, int):

        

elif not isinstance(charisma, int):

    return "All stats should be integers"  

  \#  elif isinstance(charisma, int):

        

elif name < 1 or strength < 1 or intel < 1 or charisma < 1:

    return 'All stats should be no less than 1'

elif name > 4 or strength > 4 or intel > 4 or charisma > 4:

    return 'All stats should be no more than 4'

elif name + strength + intel + charisma != 7:

    return 'The character should start with 7 points'

return 

Lesson URL: https://www.freecodecamp.org/learn/python-v9/lab-rpg-character/build-an-rpg-character

Welcome to the forum @code_master,

Which of the function parameters represent the stats?

Happy coding

Is it a rhetorical question?

name, strength, intel, charisma

No.

User Story #2 says: The function should accept, in order, a character name followed by three stats: strength, intelligence, and charisma.
User Story #3 says: The character name should be validated:
User Story #4 says: The stats should also be validated:

how can I implement it? I cannot find the solution.

First, get clear about which parameters represent the stats. The review all of the user stories again to make sure you are implementing them as asked.

for example, is name a number? if not, why are you comparing it as a number?

I don’t get it. I’m stuck.

Please talk about how you are stuck.

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!

do you see the code snippet in my code: “elif isinstance(name, int):” and “elif isinstance(strength, int):” and "elif isinstance(intel, int): " and “elif isinstance(charisma, int):”

I was thinking about if I put something in each of them, the code run will run and I will pass test #11. It says the stats need to be validated right? I just don’t know what to write. Maybe “return name” or “return strength” or “return intel” or “return charisma”? Some advice would be appreciated.

are you sure you should validate name the same way as strength ant intel?

Look at the first condition in your code:

You’re checking to make sure name is a string, right?

Then you turn around and later try to check if name is an int:

So, should name be a string or an int? What does User Story #2 tell you about your function parameters?

And User Story #5 provides an example function call: create_character('ren', 4, 2, 1)

What’s the first argument in that function call?