I do not understand what is required of me going forward!
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, inteligence, charisma):
if not isinstance(name, str):
return("The character name should be a string")
elif len(name) == 0:
return("The character should have a name")
elif len(name) > 10:
return("The character name is too long")
elif " " in name:
return("The character name should not contain spaces")
stats = [strength, inteligence, charisma]
for stat in stats:
if not isinstance(stat, int):
return("All stats should be integers")
elif stat < 1:
return("All stats should be no less than 1")
elif stat > 4:
return("All stats should be no more than 4")
if sum(stats) != 7:
return("The character should start with 7 points")
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
You need to return a string. And create_character("ren", 4, 2, 1) is a function call to test your function, which should be written outside of the function inside a print() so you can see what is returned.
Why are you trying to return the name of the function? Does that make sense?
You should return a string that is created by the values passed to the function when it is called.
If you test by calling the function like this: create_character("ren", 4, 2, 1) then your name parameter is ‘ren’, your strength parameter is 4, your intelligence parameter is 2, and your charisma parameter is 1, right?
So, now you need to create a string as asked in the instructions using the function’s parameters.
Start by simply creating a string that returns 'ren\nSTR '. How would you do that?