Tell us what’s happening:
Hello, I am running out of ideas. My code doesn’t pass test 10 and the last 2 for printing. I’ve been trying it for a while now and wrote it even anew, but stuck at the same tests…
Thank you!
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
# name validation:
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'
for i in name:
if i == ' ':
return 'The character name should not contain spaces'
# stats validation:
stats = [strength, intelligence, charisma]
for i in stats:
if not isinstance(i, int):
return 'All stats should be integers'
if i < 1:
return 'All stats should be no less than 1'
if i > 4:
return 'All stats should be no more than 4'
if sum(stats) != 7:
return 'The character should start with 7 points'
# return string
print(f'''{name}
STR {strength*full_dot}{(10-strength)*empty_dot}
INT {intelligence*full_dot}{(10-intelligence)*empty_dot}
CHA {charisma*full_dot}{(10-charisma)*empty_dot}''')
create_character('ren', 4,2,1)
Your browser information:
User Agent is: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:149.0) Gecko/20100101 Firefox/149.0
Challenge Information:
Build an RPG Character - Build an RPG Character