Tell us what’s happening:
I cant get the last two test to work.
I just used the stuff i learned so far. so no for, any, stat, etc.
Any help would be great!
Thanks!
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character (name,STR,INT,CHA):
if not isinstance(name,str):
return 'The character name should be a string'
if isinstance(name,str) and name == "":
return 'The character should have a name'
if len(name) > 10:
return 'The character name is too long'
if name.count(" ") > 0:
return 'The character name should not contain spaces'
if not isinstance(STR,int) or not isinstance(INT,int) or not isinstance(CHA,int):
return 'All stats should be integers'
if STR < 1 or INT < 1 or CHA < 1:
return 'All stats should be no less than 1'
if STR > 4 or INT > 4 or CHA > 4:
return 'All stats should be no more than 4'
if STR + INT + CHA != 7:
return 'The character should start with 7 points'
ed_STR = 10 - STR
ed_INT = 10 - INT
ed_CHA = 10 - CHA
return name + 'STR' + ' ' + full_dot * STR + empty_dot * ed_STR + 'INT' + ' ' + full_dot * INT + empty_dot * ed_INT + 'CHA' + ' ' + full_dot * CHA + empty_dot * ed_CHA
character = create_character('ren', 4, 2, 1)
print(character)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/153.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character