Build an RPG Character - Build an RPG Character

Tell us what’s happening:

What’s wrong with code?I am unable to resolve the error..please help.

Your code so far

full_dot = '●'
empty_dot = '○'
def create_character(s,strn,intl,cha):
    if not isinstance(s,str):
        return "The character name should be a string"
    elif len(s)==0:
        return "The character should have a name"
    elif len(s)>10:
        return "The character name is too long"
    for i in range(0,len(s)):
        if(s[i]==" "):
            return "The character name should not contain spaces"
    if all(not isinstance(v,int)  for v in(strn,intl,cha)):
        return "All stats should be integers"
    elif (strn and intl and cha)<1:
        return "All stats should be no less than 1"
    elif (strn and intl and cha)>4:
        return "All stats should  be no more than 4"
    elif strn+intl+cha!=7:
        return "The character should start with 7 points"
    else:
        return (s,f"\nSTR {full_dot*strn}{empty_dot*(10-strn)}\nINT{full_dot*intl}{empty_dot*(10-intl)}\nCHA{full_dot*cha}{empty_dot*(10-cha)})
p=create_character('ren',4,2,1)
print(p)
    

Your browser information:

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

There are several issues with your return statement:

  1. The requirement is to return a string, but you’re currently returning a tuple. You should include s in the f-string instead of returning (s, f"...").

  2. You’re missing the closing double quote at the end of the f-string.

  3. Please add a space after \nINT and \nCHA so that the output matches the required format.

Please check the required output format carefully and make sure your function returns the exact same string.