Tell us what’s happening:
I don’t understand where the problem is. I followed all the instructions
Your code so far
def create_character(name, strength, intelligence, charisma):
# Validate character name
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."
# Validate stats are integers
if not all(isinstance(stat, int) for stat in (strength, intelligence, charisma)):
return "All stats should be integers."
# Validate stat minimum
if not all(stat >= 1 for stat in (strength, intelligence, charisma)):
return "All stats should be no less than 1."
# Validate stat maximum
if not all(stat <= 4 for stat in (strength, intelligence, charisma)):
return "All stats should be no more than 4."
# Validate stat sum
if strength + intelligence + charisma != 7:
return "The character should start with 7 points."
# Helper to create dot line
def stat_line(label, value):
return f"{label} " + "●" * value + "○" * (10 - value)
# Build output
return (
f"{name}\n"
f"{stat_line('STR', strength)}\n"
f"{stat_line('INT', intelligence)}\n"
f"{stat_line('CHA', charisma)}"
)
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/143.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character