Tell us what’s happening:
I keep passing and failing step 3 “When create_character is called with a first argument that is a string it should not return The character name should be a string.”. I’ve been checking the code after each step, so it passed at one point.
I finished checking the stats code and then it shows that step 3 is failed again. I am at a loss of what to do since I have tried other possibilities including “if type(name) != str:” along with “if not isinstance(name, str):” I’ve also tried adding an elif.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
#Naming guidelines
if not isinstance(name, str):
return 'The character name should be a string'
if 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'
#Stats guidelines
stats = (strength, intelligence, charisma)
total = 0
if isinstance(stats, int) < 0:
return 'All stats should be integers'
if any(stats) < 1:
return 'All stats should be no less than 1'
if any(stats) > 4:
return 'All stats should be no more than 4'
if sum(stats) > 7:
return 'The character should start with 7 points'
total += sum
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character

