Build an RPG Character - Build an RPG Character

Tell us what’s happening:

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

Challenge Information:

Build an RPG Character - Build an RPG Character

You need to implement User Story #5.

I’m looking over my notes. I don’t know how to go about it.

this is how I think it should look

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”)

create_character("ren", 4, 2, 1)

return(create_character)

create_character('ren', 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○

You just need to build a string as shown in Test #11. You have been provided with global variables for the full dot and empty dot.

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.

looking at what it says i should do this fells wrong but i dont know how else o go about it

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”)

return(create_character)

name = "ren"

STR = 4

INT = 2

CHA= 1

return(create_character)

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?