Tell us what’s happening:
there is an error here, I tried to fix it with AI and tried it myself in VScode it worked but here it doesn’t work, can someone help me?
Your code so far
def create_character(name, strength, intelligence, charisma):
stats = (strength, intelligence, charisma)
total = strength + intelligence + charisma
# name validation
if not isinstance(name, str):
return 'The character name should be a string'
elif not name.strip():
return 'The character should have a name'
elif len(name) > 10:
return 'The character name is too long'
elif ' ' in name:
return 'The character name should not contain spaces'
# stats validation
elif not all(isinstance(x, int) for x in stats):
return 'All stats should be integers'
elif any(x < 1 for x in stats):
return 'All stats should be no less than 1'
elif any(x > 4 for x in stats):
return 'All stats should be no more than 4'
elif total != 7:
return 'The character should start with 7 points'
# result
return f'{name}\nSTR {full_dot * strength + empty_dot * (10 - strength)}\nINT {full_dot * intelligence + empty_dot * (10 - intelligence)}\nCHA {full_dot * charisma + empty_dot * (10 - charisma)}'
Your browser information:
User Agent is: Mozilla/5.0 (Linux; Windows 11; K) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character