May you please help with this one: The last step is failing “When create_character is called with valid values it should output the character stats as required.” Here is my code.
full_dot = '●'
empty_dot = '○'
def create_character(character_name, strength, intelligence, charisma):
if not isinstance(character_name, str):
return 'The character name should be a string'
if len(character_name) ==0:
return 'The character should have a name'
if len(character_name) > 10:
return 'The character name is too long'
if not isinstance(strength,int):
return 'All stats should be integers'
if not isinstance(intelligence,int):
return 'All stats should be integers'
if not isinstance(charisma,int):
return 'All stats should be integers'
if ' ' in character_name:
return 'The character name should not contain spaces'
if strength < 1 or intelligence < 1 or charisma < 1:
return 'All stats should be no less than 1'
if strength > 4 or intelligence > 4 or charisma > 4:
return 'All stats should be no more than 4'
if not strength + intelligence + charisma ==7:
return 'The character should start with 7 points'
else :
strenth_empty= empty_dot \* (10 - strength)
intelligence_empty= empty_dot \* (10 - intelligence)
charisma_empty= empty_dot \* (10 - charisma)
return f'{character_name}\\nSTR {full_dot\*strength}{strenth_empty}\\nINT {full_dot\*intelligence}{intelligence_empty}\\nCHA {full_dot}{charisma_empty}'
print(create_character('ren', 4, 2, 1))
