Test 8 and onward aren’t running, what’s the issue? I’ve tested other people’s solutions but they still wont run.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
#name validations
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"
#stat validations
stats = [strength, intelligence, charisma]
if not isinstance(stats, 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"
def make_bar(value):
return full_dot * value + empty_dot * (10 - value)
result = f"""{name}
STR {make_bar(strengeth)}
INT {make_bar(intelligence)}
CHA {make_bar(charisma)}"""
return result
print(create_character("ren", 4, 2, 1))
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
People won’t be posting solution code to the forum. They are posting code that does not work. So, if you copy/paste code from the forum it’s not going to work.
You need to read the threads, understand the problem and implement the solution yourself.
sorry bad wording, I was looking at how other people wrote it.
I was using stats = [strength, intelligence, charisma] to make the code not as long but scraped that idea and did it like if strength < 1 or intelligence < 1 or charisma < 1: and forgot to delete it. I used the stats thing to write if not isinstance(stats, int): .
i did for the next lines but for some reason if not isinstance(stats, int): works and solves the test “When create_character is called with a second, third or fourth argument that is not an integer it should return All stats should be integers.”