Tell us what’s happening:
line 16 in my code is chowing error can anyone help me.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, str_bar, int_bar, cha_bar):
strength=((full_dot*str_bar)+(empty_dot)*(10-str_bar))
intelligence=((full_dot*int_bar)+(empty_dot)*(10-int_bar))
charisma=((full_dot*cha_bar)+(empty_dot)*(10-cha_bar))
if type(name) is not str:
return 'The character name should be a string'
elif len(name) is 0:
return 'The character should have a name'
elif len(name) > 10:
return 'The character name is too long'
elif name.find(' ') !=-1:
return 'The character name should not contain spaces'
if not isinstance(str_bar, int) or not isinstance(int_bar, int) or not isinstance(cha_bar, int):
return 'All stats should be integers'
elif str_bar < 1 or int_bar < 1 or cha_bar < 1:
return 'All stats should be no less than 1'
elif str_bar > 4 or int_bar > 4 or cha_bar > 4:
return 'All stats should be no more than 4'
elif (str_bar + int_bar + cha_bar) is not 7:
return 'The character should start with 7 points'
else:
return f'{name}\nSTR {strength}\nINT {intelligence}\nCHA {charisma}'
print(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/147.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character