Build an RPG character

Hi, I submitted what I thought was a valid multi-line f-string matching the guidelines but test cases 9 & 10 fail unless I build my output with newline characters. Am I right to think it’s an issue or is there something wrong with my code that I cannot see? Appreciate the help.

Here’s the code:

full_dot = '●'
empty_dot = '○'

def create_character(name, strength, intelligence, charisma):
    
    # name validation
    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"

    # stats validation
    stats = [strength, intelligence, charisma]
    if not all(isinstance(s, int) for s in stats):
        return "All stats should be integers"
    if any(s < 1 for s in stats):
        return "All stats should be no less than 1"
    if any(s > 4 for s in stats):
        return "All stats should be no more than 4"
    if sum(stats) != 7:
        return "The character should start with 7 points"

    dots = [s*full_dot + (10-s)*empty_dot for s in stats]

    return f"""{name}
STR {dots[0]}
INT {dots[1]}
CHA {dots[2]}
"""

print(create_character("ren", 4, 2, 1)) # fails...

…and here’s the working output:

return f"{name}\nSTR {dots[0]}\nINT {dots[1]}\nCHA {dots[2]}"

Is an f string supposed to be nested in three quotes?

this one ends with a new line character, the other one does not, they are not the same

Ha! I learned something here! :slight_smile:

Ohhh, I completely forgot that putting the end quotes on a new line will do that. Thank you!