Tell us what’s happening:
When create_character is called with a first argument that is a string it should not return The character name should be a string.
full_dot = ‘●’
empty_dot = ‘○’
def create_character(name, strenght, intelligence, charisma):
if not isinstance(name, str):
return ‘The character name should be a string’
elif 0 == len(name):
return ‘The caracter should have a name’
elif 10 < len(name):
return ‘The character namis too long’
elif ’ ’ in name:
return 'Th
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strenght, intelligence, charisma):
if not isinstance(name, str):
return 'The character name should be a string'
elif 0 == len(name):
return 'The caracter should have a name'
elif 10 < len(name):
return 'The character namis too long'
elif ' ' in name:
return 'The character name should not contain spaces'
if not isinstance(strenght, int) or not isinstance(intelligence, int) or not isinstance(charisma, int):
return 'All stats should be integer'
elif 1 > strenght or 1 > intelligence or 1 > charisma:
return 'All stats should no less than 1'
elif 4 < strenght or 4 < intelligence or 4 < charisma:
return 'All stats should no more than 4'
elif 7 < sum(strenght, intelligence, charisma):
return 'The character should start with 7 points'
Character_name = name
Strenght = full_dot * strenght + empty_dot * (10 - strenght)
intelligence = full_dot * intelligence + empty_dot * (10 - intelligence)
charisma = full_dot * charisma + empty_dot * (10 - charisma)
return f"{name}\nSTR: {str_dots}\nINT: {int_dots}\nCHA: {cha_dots}"
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/149.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character
