Tell us what’s happening:
I am having trouble getting past the 9th and 10th tests.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, stre, intel, cha):
if not isinstance(name, str):
return "The character name should be a string"
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(isinstance(x, int) for x in [stre, intel, cha]):
return "All stats should be integers"
if min(stre, intel, cha) < 1:
return "All stats should be no less than 1"
if max(stre, intel, cha) > 4:
return "All stats should be no more than 4"
if stre + intel + cha != 7:
return "The character should start with 7 points"
rstr = 10 - stre
rint = 10 - intel
rcha = 10 - cha
return f"""\
{name}
STR {stre * full_dot}{rstr * empty_dot}
INT {intel * full_dot}{rint * empty_dot}
CHA {cha * full_dot}{rcha * empty_dot}
"""
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/142.0.0.0 Safari/537.36
Challenge Information:
Build an RPG character - Build an RPG Character