Tell us what’s happening:
So in Buld an RPG Character, steps 18 and 19, im having a bit of trouble printing the required steps onto the console. I feel that I am missing a step that requires using the dot variables but im not exactly sure how to use it. If anyone could help me and also suggest any ways to shorten the amount of elif statements needed. Please and thank you.
Your code so far
def create_character(name, STR, INT, CHA):
full_dot = '●'
empty_dot = '○'
if not isinstance(name, str):
return 'The character name should be a string'
elif name == '':
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'
elif not isinstance(STR, int):
return 'All stats should be integers'
elif not isinstance(INT, int):
return 'All stats should be integers'
elif not isinstance(CHA, int):
return 'All stats should be integers'
elif STR < 1:
return 'All stats should be no less than 1'
elif INT < 1:
return 'All stats should be no less than 1'
elif CHA < 1:
return 'All stats should be no less than 1'
elif STR > 4:
return 'All stats should be no more than 4'
elif INT > 4:
return 'All stats should be no more than 4'
elif CHA > 4:
return 'All stats should be no more than 4'
elif STR + INT + CHA != 7:
return 'The character should start with 7 points'
create_character('ren', 4, 2, 1)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/146.0.0.0 Safari/537.36 Edg/146.0.0.0
Challenge Information:
Build an RPG Character - Build an RPG Character