Build an RPG Character - Build an RPG Character

Tell us what’s happening:

Please, I couldn’t tell what is making my code to keep failing to knock off these eight test points. Many times the test points have flipped status as I try different ideas but they won’t clear off, in spite of the fact that the code appears not to have any problems. Any idea what might be the problem?Thanks for the help. Very much appreciate it.

Your code so far

full_dot = '●'
empty_dot = '○'
def create_character(name, STR, INT, CHA):
    if not isinstance(name,str):
        return "The character name should be a string"

    if not name:
        return "The character should have a name"
    else:
        return None 

    if len(name) > 10:
        return "The character name is too long"
    else:
        return None

    if "" in name:
        return "The character name should not contain spaces"
        
    if not isinstance((STR,int) or not isinstance (INT,int) or not isinstance(CHA,int)):
        return "All stats should be integers"
        
    if (STR < 1) or (INT < 1) or (CHA < 1):
        return "All stats should be no less than 1"
        
    if (STR > 4) or (INT > 4) or (CHA > 4):
        return "All stats should be no more than 4"

    if STR + INT + CHA < 7:
        return "The character should start with 7 points"

    RNG = 10
    print(name)   
    print(full_dot * STR + empty_dot * (RNG - STR))   
    print(full_dot * INT + enpty_dot * (RNG - INT)) 
    print(full_dot * CHA + empty_dot * (RNG - CHA))

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





Your browser information:

User Agent is: Mozilla/5.0 (Linux; Android 10; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Mobile 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

Print your function call (the last line) and see what your function is returning.

You need to do some tests and see if your function is working. What is it returning?

  1. If all values pass the verification, the function should return a string
1 Like