I believe there is a bug with your online Python interpreter

I am currently trying to rewrite my code in a more complicated way. I will leave the bug report here, though:

Dear freeCodeCamp Support, thank you for taking your time to read this. I think there is a bug in your Python interpreter. I am currently doing /learn/python-v9/lab-rpg-character/build-an-rpg-character and I have noticed that when I print("Wordy Words", end="", the terminal output is Wordy Words [object Object] and the next print() function will still print on a new line. Now, [object Object] is a JavaScript thing. And when I run my code in Thonny, the result is as intended.

Here is my code:

Click to expand
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 not 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"
    if not (isinstance(strength, int) and isinstance(intelligence, int) and isinstance(charisma, int)):
        return "All stats should be integers"
    if strength < 1 or intelligence < 1 or charisma < 1:
        return "All stats should be no less than 1"
    if strength > 4 or intelligence > 4 or charisma > 4:
        return "All stats should be no more than 4"
    if strength + intelligence + charisma != 7:
        return "The character should start with 7 points"
    print(name + " \nSTR ", end="")
    for i in range(strength):
        print(full_dot, end="")
        remaining = 9-i
    for i in range(remaining):
        print(empty_dot, end="")
    print("\nINT ", end="")
    for i in range(intelligence):
        print(full_dot, end="")
        remaining = 9-i
    for i in range(remaining):
        print(empty_dot, end="")
    print("\nCHA ", end="")
    for i in range(charisma):
        print(full_dot, end="")
        remaining = 9-i
    for i in range(remaining):
        print(empty_dot, end="")
create_character('ren', 4, 2, 1)

freeCodeCamp terminal output:

Click to expand
ren 
STR  [object Object]
● [object Object]
● [object Object]
● [object Object]
● [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]

INT  [object Object]
● [object Object]
● [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]

CHA  [object Object]
● [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]

Thonny shell output:

Click to expand

>>> %Run test.py
ren 
STR ●●●●○○○○○○
INT ●●○○○○○○○○
CHA ●○○○○○○○○○
>>> 

Thanks in advance for your response,
hiitsmeiguess Wednesday, the 13th of May, 2026 at 12:21

Edit:

Here is the console output (the console in the lab editor, not the browser console):

Click to expand
// running tests
18. create_character('ren', 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.
19. When create_character is called with valid values it should output the character stats as required.
// tests completed
// console output
CHA ●●●●○○○○○○ren 
STR ●●●●○○○○○○
INT ●●○○○○○○○○

I am currently trying to rewrite my code in a more complicated way. I will leave the bug report here, though: That didn’t work either. Amazing code for a coding website, mates.

Dear freeCodeCamp Support, thank you for taking your time to read this. I think there is a bug in your Python interpreter. I am currently doing /learn/python-v9/lab-rpg-character/build-an-rpg-character and I have noticed that when I print("Wordy Words", end="", the terminal output is Wordy Words [object Object] and the next print() function will still print on a new line. Now, [object Object] is a JavaScript thing. And when I run my code in Thonny, the result is as intended.

Here is my code:

Click to expand
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 not 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"
    if not (isinstance(strength, int) and isinstance(intelligence, int) and isinstance(charisma, int)):
        return "All stats should be integers"
    if strength < 1 or intelligence < 1 or charisma < 1:
        return "All stats should be no less than 1"
    if strength > 4 or intelligence > 4 or charisma > 4:
        return "All stats should be no more than 4"
    if strength + intelligence + charisma != 7:
        return "The character should start with 7 points"
    print(name + " \nSTR ", end="")
    for i in range(strength):
        print(full_dot, end="")
        remaining = 9-i
    for i in range(remaining):
        print(empty_dot, end="")
    print("\nINT ", end="")
    for i in range(intelligence):
        print(full_dot, end="")
        remaining = 9-i
    for i in range(remaining):
        print(empty_dot, end="")
    print("\nCHA ", end="")
    for i in range(charisma):
        print(full_dot, end="")
        remaining = 9-i
    for i in range(remaining):
        print(empty_dot, end="")
create_character('ren', 4, 2, 1)

freeCodeCamp terminal output:

Click to expand
ren 
STR  [object Object]
● [object Object]
● [object Object]
● [object Object]
● [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]

INT  [object Object]
● [object Object]
● [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]

CHA  [object Object]
● [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]
○ [object Object]

Thonny shell output:

Click to expand

>>> %Run test.py
ren 
STR ●●●●○○○○○○
INT ●●○○○○○○○○
CHA ●○○○○○○○○○
>>> 

Thanks in advance for your response,
hiitsmeiguess Wednesday, the 13th of May, 2026 at 12:21

Edit:

Here is the console output (the console in the lab editor, not the browser console):

Click to expand
// running tests
18. create_character('ren', 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.
19. When create_character is called with valid values it should output the character stats as required.
// tests completed
// console output
CHA ●●●●○○○○○○ren 
STR ●●●●○○○○○○
INT ●●○○○○○○○○

The interpreter does not support all Python features.

Python is not a native browser language, so the system used to allow for Python to be executed in the browser is not a perfect Python environment. You see JavaScript affects, because it’s JavaScript at the end.

Also note you are not asked to print anything in this lab, only for the function to return certain things.

I’m aware. If I return, however, it does the exact same thing. And I don’t pass if it doesn’t do exactly that.

Also here is my new code, which returns exactly what is asked, but just doesn’t like it. I don’t know what my code ever did to hurt the interpreter’s feelings :frowning:

it looks like your code is missing, please post your code if you want to receive help

If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Help button located on the challenge.

The Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.

Thank you.

Oops sorry, here it is:

full_dot = '●'
empty_dot = '○'

def arrange_dots(prefix, value):
    if value == 1:
        return prefix + full_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot
    elif value == 2:
        return prefix + full_dot + full_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot
    elif value == 3:
        return prefix + full_dot + full_dot + full_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot
    elif value == 4:
        return prefix + full_dot + full_dot + full_dot + full_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot
    elif value == 5:
        return prefix + full_dot + full_dot + full_dot + full_dot + full_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot
    elif value == 6:
        return prefix + full_dot + full_dot + full_dot + full_dot + full_dot + full_dot + empty_dot + empty_dot + empty_dot + empty_dot
    elif value == 7:
        return prefix + full_dot + full_dot + full_dot + full_dot + full_dot + full_dot + full_dot + empty_dot + empty_dot + empty_dot
    elif value == 0:
        return prefix + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot + empty_dot
def create_character(name, strength, intelligence, charisma):
    if not isinstance(name, str):
        return "The character name should be a string"
    if not 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"
    if not (isinstance(strength, int) and isinstance(intelligence, int) and isinstance(charisma, int)):
        return "All stats should be integers"
    if strength < 1 or intelligence < 1 or charisma < 1:
        return "All stats should be no less than 1"
    if strength > 4 or intelligence > 4 or charisma > 4:
        return "All stats should be no more than 4"
    if strength + intelligence + charisma != 7:
        return "The character should start with 7 points"
    character = name + "\n"
    character += arrange_dots("STR ", strength) + "\n"
    character += arrange_dots("INT ", intelligence) + "\n"
    character += arrange_dots("CHA ", charisma) + "\n"
    return character
print(create_character('ren', 4, 2, 1))

I am posting this here because the interpreter is rejecting my solution

look at the string expected in test 18, specifically the end. And then confront, what is the last character in the string you return?

Oh boy I’m an idiot :man_facepalming: