All the posts I checked regarding this question is not helping unfortunately.
I haven’t done the steps beyond these ones since I do not want to get mixed up even further
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
if not isinstance(name, str):
return 'The character name should be a string'
if len(name) == 0:
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 = strength, intelligence, charisma
if not isinstance(stats, int):
return 'All stats should be integers'
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
Adding the space back in solved Steps 9 and 10 instantly lol.
But a new problem has appeared. By just adding back the space, for some reason, stats satisfies Step 10, which is rather confusing. Step 11 isn’t satisfied though.
here I recommend adding multiples print() statements to your code. They are primordial for debugging (see more here, in the print() section). You can also use a tool like Pythontutor, that help visualizing your code better.
Also , you added :
It is not the space that caused the test 11 to fail, it just didn’t pop out on your screen. You can see every test that failed by scrolling all the way down the instructions or by reading the terminal.
Try to print an instance of the function with the values of your choice, and check if your if statements trigger right (or not). For example try : print(create_character('ren', 4, 2, 1)). This is a valid example so it shouldn’t raise any error.
Later, you do this :
Try printing stats, and type(stats).
Be careful, an isinstance() check of a list containing various item is not the same as checking each item separately.