i am not able to pass the test even thoygh my code is giving right output in terminal for RPG character building
please share your code and a link to the challenge
thank you for the link, now please share your code
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 = \[strength, intelligence, charisma\]
if not all(isinstance(stat, int)for stat in stats):
return 'All stats should be integers.'
if not all (stat >= 1 for stat in stats):
return ' All stats should be no less than 1.'
if not all (stat <= 4 for stat in stats):
return 'All stats should be no more than 4.'
if sum(stats) != 7:
return 'The character should start with 7 points.'
def stat_line(label, value):
return f"{label} " + "●" \* value + "○" \* (10 - value)
\# Build result
return "\\n".join(\[
name,
stat_line("STR", strength),
stat_line("INT", intelligence),
stat_line("CHA", charisma)
\])
print(create_character(42, 2, 3, 2))
print(create_character(“”, 2, 3, 2))
print(create_character(“abcdefghijlmnop”, 2, 3, 2))
print(create_character(‘foo’, 2, 3, 2))
print(create_character(" ", 2, 3, 2))
print(create_character(‘bar’, 2, “ram”,4))
print(create_character(‘bar’, -2, 3, 2))
print(create_character(‘bar’, 6, 3, 2))
print(create_character(‘bar’, 2, 4, 2))
print(create_character(‘ren’, 4, 2, 1))
print(create_character(‘bar’, 2, 3, 2))
Double check the messages you are returning. Should they have punctuation?