if type(name) is not 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 = (strength, intelligence, charisma)
if not all(isinstance(x, int) and not isinstance(x, bool) for x in stats):
return "All stats should be integers."
if any(x < 1 for x in stats):
return "All stats should be no less than 1."
if any(x > 4 for x in stats):
return "All stats should be no more than 4."
if sum(stats) != 7:
return "The character should start with 7 points."
full = "â—Ź"
empty = "â—‹"
def bar(v):
return full * v + empty * (10 - v)
return "\n".join([
name,
"STR " + bar(strength),
"INT " + bar(intelligence),
"CHA " + bar(charisma),
])
You included a period in the code you posted. It looks to me based off your screenshot that the period is not included in the output the test is looking for. It is a very perticular and exact test and when they are looking for a returned string it needs to be exact down to the puncuation included in the squared off region of the hint or testing module.
Also happy coding and glad to have you here if you need more help feel free to reply and I and the others here will do our best to guide you along the way. However we are not permitted o give you direct and exact answers to your problems and instead rely on the Socratic method of teaching.