Build an RPG Character - Build an RPG Character

Tell us what’s happening:

I am on the " Build an RPG Character" lab
test#2 fails: when create a character is called with a first argument that is not a string it should return " The character name should be a string '" what i did: * I added print(repr(create_character(123, 1, 1 ,1)))
to my code it prints “The character name should be a string”(exactly as required no extra spaces, no hidden characters)
the test still fails
is this a bug in test runner, or am i missing something??

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) > 10:
        return "The character name is too long."  
    if name == "":
        return "The character should have a name."
    if ' ' in name:
        return "The character name should not contain spaces."
            
    stats = {"STR": strength, "INT": intelligence, "CHA": charisma}
    for stat_name, value in stats.items():
        if not isinstance(value, int):
            return "All stats should be integers."
        if value < 1:
            return " All stats should be no less than 1."
        if value > 4:
            return " All stats should be no more than 4."
    if sum(stats.values()) != 7:
        return "The character should start with 7."

    line1 = name
    line2 = f"STR {full_dot * strength}{empty_dot * (10 - strength)}"
    line3 = f"INT {full_dot * intelligence}{empty_dot *(10 - intelligence)}"
    line4 = f"CHA {full_dot * charima}{empty_dot *(10 - charisma)}"
    return f"{line1}\n{line2}\n{line3}\n{line4}"
    
    



Your browser information:

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

Challenge Information:

Build an RPG Character - Build an RPG Character

GitHub Link: https://github.com/freeCodeCamp/freeCodeCamp/blob/main/curriculum/challenges/english/blocks/lab-rpg-character/67d83df6f82eda3868dd2a84.md

Welcome to the forum @ROSE71,

Please review all of your return messages to make sure they match the instructions (check punctuation).

Happy coding

Yes I checked it and the output is exactly this . I feel so stuck I’ve been working on this since afternoon I’ve checked all the ways it still shows the exact same issue

They are not exact. Check again.

Sorry I don’t get it ,?

Please explain what you don’t get…

Try this:

copy/paste one of the messages in the instructions
copy/paste the same message from your code beneath it to compare

what is different?

there isn’t a period/full stop

there is a period/full stop

they are not the same

i removed the periods and the problem i am facing now is step 1&2 are correct but from 3 alternatively its showing error…like 3..5..7..till 13 then 14th is correct and from 15 to 19 its all wrong again …now I’m even more confused about what’s happening.

When you see this message in the console after running the tests, check your browser’s console to see the error:

Your code raised an error before any tests could run. Please fix it and try again.

You have a typo.

Test what your function returns like this:

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

i give up at this point nothing’s working

There is very little wrong with your code at this point, so maybe take a break and come back to it when you’re refreshed.

Alright .. thanks for the guidance though.

You’re welcome. Please don’t let this overwhelm you. You’re doing great…your logic is solid. You just have a typo and a couple more errors with non-matching messages re: spacing.

yeah there was an spelling error that went unnoticed the code passed .. again thankyou for the help. finally passed the tests .