Tell us what’s happening:
not meeting criteria 10 which asks to evaluate the stats to see if they are not integers. I’ve tested it however and it does work and it even tells me when I test floats in the function call that they aren’t integers. maybe I gotta re-write it again? this is the only criteria I need
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, STR, INT, CHA):
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 = [STR, INT, CHA]
stats_sum = STR + INT + CHA
for stat in stats:
if stat < 1:
return "All stats should be no less than 1"
if stat > 4:
return "All stats should be no more than 4"
if not isinstance(stat, int):
return "All stats should be integers"
if stats_sum != 7:
return "The character should start with 7 points"
def bar(value):
return full_dot*value + empty_dot*(10-value)
return f'{name}\nSTR {bar(STR)}\nINT {bar(INT)}\nCHA {bar(CHA)}'
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/605.1.15 (KHTML, like Gecko) Version/26.3.1 Safari/605.1.15
Challenge Information:
Build an RPG Character - Build an RPG Character