Build an RPG Character - Test 5 failed

Tell us what’s happening:

"Failed:5. The create_character function should not say that the character is too long when it’s not longer than 10 characters.
"
I acually dont know what this test wants. I am grateful for any help.

It reads to me kind of like the 4th Test with the difference that it talks about “the character” instead of the name and the double negative :
“4. When create_character is called with a first argument that is longer than 10 characters it should return The character name is too long.”

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"
    if not all_stats_are_ints(strength, intelligence, charisma):
        return "All stats should be integers"
    if all_stats_are_atleast_one(strength, intelligence, charisma):
        return "All stats should be no less than 1"
    if all_stats_are_4_or_less(strength, intelligence, charisma):
        return "All stats should be no more than 4"
    if sum_of_stats(strength, intelligence, charisma) != 7:
        return "The character should start with 7 points"

    print (name)
    print ("STR " + print_stats_dots(strength))
    print ("INT " + print_stats_dots(intelligence))
    print ("CHA " + print_stats_dots(charisma))

def all_stats_are_atleast_one(int1, int2, int3):
    return int1 >=1 & int2 >=1 & int3 >=1 

def all_stats_are_ints(int1, int2, int3):
    return isinstance(int1, int) & isinstance(int2, int) & isinstance(int3, int)

def all_stats_are_4_or_less(int1, int2, int3):
    return int1 <=4 & int2 <=4 & int3 <=4

def sum_of_stats(int1, int2, int3):
    return int1 + int2 + int3

def print_stats_dots(number):
    print (print_full_dots(strength) + print_empty_dots(10 - strength))

def print_full_dots(number):
    for i in range(number):
        print ('●')
def print_empty_dots(number):
    for i in range(number):
        print ('○')

#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/144.0.0.0 Safari/537.36 Edg/144.0.0.0

Challenge Information:

Build an RPG Character - Build an RPG Character

don’t you see this error in the console when you run the tests?

Your code raised an error before any tests could run. Please fix it and try again.

if you uncomment the call #create_character('ren', 4, 2, 1) you should see a name error that needs to be fixed

if you don’t see this error, the code you have shared is not the one you are using

i think that this line somehow creates issues. I deleted it and the 5th test was somehow complete, despite not influencing it (is what i assume). After switching back and forth i could not recreate the error.

I see testerrors now. dont know if i was just blind or they appeared now. Am Stuck on Test 8-12 now. ill fix em all!!

1 Like

Just did it! Everything is working pretty. used AI tho

Have Fun Coding!

In what way did you use AI?