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 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'
if not isinstance(strength, int) or not isinstance(intelligence, int) or not isinstance(charisma, int):
return'All stats should be integers'
If you have a question about a specific challenge as it relates to your written code for that challenge and need some help, click the Get Help > Ask for Help button located on the challenge.
The Ask for Help button will create a new topic with all code you have written and include a link to the challenge also. You will still be able to ask any questions in the post before submitting it to the forum.
Thank you.
My code can’t pass test 7, what am I doing wrong?
I’m not sure, what is test 7? What does your program return?
Can you post a link to the lab?
so, test 7 is:
- When
create_characteris called with a second, third or fourth argument that is not an integer it should returnAll stats should be integers.
What does your function return when you call it with a second, third or fourth argument that is not an integer?
You’ll need to call your function and print the result to find out.
Is something wrong with line 14 of the code because thats where the problem is at?
Your issue is here. I keep seeing this same error over and over on the forum. Remember, when you copy someone’s code from the forum, you are also copying their errors.
Is ‘’ a space?
do not assume, check what your function is returning, use print and call the function
But it did pass the test on step 6.
that does not mean that there isn’t an issue with that line, please look at what your function is returning with print(create_character('ren', 1.1, 2.2, 3.3))
print() is one of the most crucial tools for understanding the operation of your program and debugging it. You should use it, otherwise you are just making educated guesses and not using empirical data.
It’s like walking around blindfolded and assuming you are going the right way because no one is yelling at you.
