Build an RPG Character - Build an RPG Character

Tell us what’s happening:

I keep passing and failing step 3 “When create_character is called with a first argument that is a string it should not return The character name should be a string.”. I’ve been checking the code after each step, so it passed at one point.

I finished checking the stats code and then it shows that step 3 is failed again. I am at a loss of what to do since I have tried other possibilities including “if type(name) != str:” along with “if not isinstance(name, str):” I’ve also tried adding an elif.

Your code so far

full_dot = '●'
empty_dot = '○'

def create_character(name, strength, intelligence, charisma):
    #Naming guidelines
    if not isinstance(name, str):
        return 'The character name should be a string'
    if name == '':
        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'
    
    #Stats guidelines
    stats = (strength, intelligence, charisma)
    total = 0
    if isinstance(stats, int) < 0:
        return 'All stats should be integers'
    if any(stats) < 1:
        return 'All stats should be no less than 1'
    if any(stats) > 4:
        return 'All stats should be no more than 4'
    if sum(stats) > 7:
            return 'The character should start with 7 points'
    total += sum

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36

Challenge Information:

Build an RPG Character - Build an RPG Character

GitHub Link: freeCodeCamp/curriculum/challenges/english/blocks/lab-rpg-character/67d83df6f82eda3868dd2a84.md at main · freeCodeCamp/freeCodeCamp · GitHub

Welcome to the forum @kbcharski

Did you see the traceback in the console?

Happy coding

I haven’t touched anything since I posted to the forum. I actually do not see a traceback in the console at all. I am not sure why I don’t see the traceback in the console (screenshot below). I suppose it could be I am on a very old surface tablet during my down time at work. :thinking:

I’ll pause here for a bit and view it on my desktop at home.

you should try calling the function, it is the first thing you should always do when testing

Thank you for the tip! I will definitely keep it in mind.

I’m pretty new to coding. So I’ve had a ton of trial and error. I did eventually finish the Build an RPG Character between periods of thinking about what I had written and the errors I was getting.

Before I move on, the current plan is to redo all of the interactive builds and try to problem solve without the help of the forums. My other goal is to try and do similar projects without the guides for each step.