Build an RPG character - Build an RPG Character

Tell us what’s happening:

I’ve looked at the posts on the forum and I still can’t see a problem with my code, but it’s flagging tests 5, 7, 8, 9, and 10!

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 len(name)>10:
        return 'The character name is too long'
    if ' ' in name:
        return 'The character name should not contain spaces'
    if not isinstance(Str or Int or Cha, int):
        return 'All stats should be integers'
    if (Str or Int or Cha < 1):
        return 'All stats should be no less than 1'
    if (Str or Int or Cha > 4):
        return 'All stats should be no more than 4'
    if not (Str + Int + Cha == 7):
        return 'The character should start with 7 points'
    print(name)
    print("STR" + " " + full_dot == Str + empty_dot == 10 - Str)
    print("INT" + " " + full_dot == Int + empty_dot == 10 - Int)
    print("CHA" + " " + full_dot == Cha + empty_dot == 10 - Cha)
    
create_character("ren", 4, 2, 1)

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/138.0.0.0 Safari/537.36

Challenge Information:

Build an RPG character - Build an RPG Character
https://www.freecodecamp.org/learn/full-stack-developer/lab-rpg-character/build-an-rpg-character

Welcome to the forum @TheCoInTim.Co

For test 5, what does calling create_character("ren", 1, 'c', 1) output?

Happy coding

It doesn’t work, the only output I get no matter the input is the string about it being less than one.

Okay, I fiddled with it and got it to work for everything but 9 and 10

if you want more help you need to post your updated code please

how do I do that? (character to reach minimum)

copy the code from the editor, paste the code here

When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

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 len(name)>10:
        return 'The character name is too long'
    if ' ' in name:
        return 'The character name should not contain spaces'

    if not isinstance(Str, int):
        return 'All stats should be integers'
    if not isinstance(Int, int):
        return 'All stats should be integers'
    if 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):
        return 'All stats should be no more than 4'
    if (Int > 4):
        return 'All stats should be no more than 4'
    if (Cha > 4):
        return 'All stats should be no more than 4'
    stats = [Str, Int, Cha]
    if not sum(stats) == 7:
        return 'The character should start with 7 points'
    Str_dot = full_dot * Str + empty_dot * (10 - Str)
    Int_dot = full_dot * Int + empty_dot * (10 - Int)
    Cha_dot = full_dot * Cha + empty_dot * (10 - Cha)
    print(f'{name}\nStr {Str_dot}\nInt {Int_dot}\nCha {Cha_dot}')
    
create_character("ren", 4, 2, 1)

like this?

what is your function returning in that case?

print(f'{name}\nStr {Str_dot}\nInt {Int_dot}\nCha {Cha_dot}')

this I believe

no, that is not returning anything, look back at how you are returning stuff in all the other cases that work

I’m using the return function

to be precise return is not a function

but you are right that you are not using it in this case

once you fix that, you need to carefully look at the string you are asked to return and the one you are returning, you have some capitalization issues