Build an RPG Character - Build an RPG Character

Tell us what’s happening:

I am not able to find next step in this project result is not obtaining as expected

Your code so far

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 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"
    stats = {'STR': strength,'INT': intelligence,'CHA':charisma}
    for stat in stats.values():
        if not isinstance(stat, int):
            return "All stats should be integers"
    for stat in stats.values():
        if stat < 1:
            return "All stats should be no less than 1"
    for stat in stats.values():
        if stat > 4:
            return "All stats should be no more than 4"
    if strength + intelligence + charisma != 7:
        return "The character should start with 7 points"
    player_stat = (name + "\n")    
    player_stat += ("STR "+ (strength * full_dot) + (10 - strength) * empty_dot + "\n")
    player_stat += ("INT "+ (intelligence * full_dot) + (10 - intelligence) * empty_dot + "\n")
    player_stat += ("CHA "+ (charisma * full_dot) + (10 - charisma) * empty_dot + "\n")
    return player_stat
create_character('ren', 4, 2, 1)





Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/137.0.0.0 Safari/537.36

Challenge Information:

Build an RPG Character - Build an RPG Character

Hi @shagun7924

To help you debug, add the following print call after the function.

print(repr(create_character('ren', 1, 2, 4)))

Happy coding

it is not working now also

I have spent a few minutes trying to figure this out for you and I do not have a concrete solution but I believe it has to do with formatting. The instructions ask for the function to be returned as ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○

It appears to me that your code returns this:

ren
STR ●●●●○○○○○○
INT ●●○○○○○○○○
CHA ●○○○○○○○○○

I could be way off the mark here but I would try to rewrite the last few variables of player_stat to output the value as it requests in the test. let me know the result if you try this and it works. Happy coding!