Build an RPG Character - Build an RPG Character

Tell us what’s happening:

I am running into an issue where my code doesn’t pass test 2: “When create_character is called with a first argument that is not a string it should return The character name should be a string.” I have tried a few variants of the if statement that references this condition, which didn’t work, and when I reviewed the forum, I see that other code with the same statement has passed this test. I’m pretty lost as to what to do here. Can anyone help?

Your code so far

full_dot = '●'
empty_dot = '○'


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

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

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36

Challenge Information:

Build an RPG Character - Build an RPG Character

Welcome to the forum @stephanie !

If you test your function like this:

print(create_character(10, 4, 2, 1))

You will see that your function is actually returning None.

Happy coding!

good evening guys. Im new to coding and really need a real person to be my tutor and guide rather than just trying to figure it out on my own. we can fix a schedule for live classes at convenient times . I will be glad to get a reply guys !

Welcome to the forum @snskes,

Please read the freeCodeCamp forum’s Code of Conduct.

  1. We do not offer DM support, voice support, or any other 1-on-1 mentorship/assistance.

That said, this forum is always available to help you with specific questions about your code.


In the future, please create your own topic when you have specific questions about your own challenge code. Only respond to another thread when you want to provide help to the original poster of the other thread or have follow up questions concerning other replies given to the original poster.

The easiest way to create a topic for help with your own solution is to click the Help button image located on each challenge. This will automatically import your code in a readable format and pull in the challenge URL while still allowing you to ask any question about the challenge or your code.

Thank you.

1 Like

Thank you! This helped me figure out what was wrong. Now to fix the rest of the code lol.