Build an RPG Character

full_dot = ‘●’

empty_dot = ‘○’

def create_character(name, stg, ing, cha):

#Character name validation

if type(name) != str:

return ‘The character name should be a string’

if not 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’

#Stat validation

if type(stg) != int or type(ing) != int or type(cha) != int:

return ‘All stats should be integers’

if stg < 1 or ing < 1 or cha < 1:

return ‘All stats should be no less than 1’

if stg > 4 or ing > 4 or cha > 4:

return ‘All stats should be no more than 4’

if (stg + ing + cha) != 7:

return ‘The character should start with 7 points’

#Output

return name + ‘\n’ +\

"STR " + (full_dot * stg) + (empty_dot * (10-stg)) + ‘\n’ +\

"INT " + (full_dot * ing) + (empty_dot * (10-ing)) + ‘\n’ +\

"CHA " + (full_dot * cha) + (empty_dot * (10-cha))

:balloon: Hi, welcome to the forum!
We see you have posted some code but did you have a question?

(You have not filled out the “Tell us what’s happening:” field above)

Please post a link to the lab you are working on as well