Build an RPG character - Build an RPG Character

Tell us what’s happening:

I can’t move on with the curriculum until I complete this RPG lab. #12 is still showing it’s wrong even though I have the correct character stats in my terminal. What am I missing? Can someone help?

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 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 = (strength, intelligence, charisma)
    if not all(isinstance(stat, int) for stat in stats):
        return 'All stats should be integers'
    if not all(stat >= 1 for stat in stats):
        return 'All stats should be no less than 1'
    if not all(stat <= 4 for stat in stats):
        return 'All stats should be no more than 4'
    if sum(stats) != 7:
        return 'The character should start with 7 points'

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

Your browser information:

User Agent is: Mozilla/5.0 (X11; CrOS x86_64 14541.0.0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/142.0.0.0 Safari/537.36

Challenge Information:

Build an RPG character - Build an RPG Character

Looks good overall! It looks like you may have copied the output expected to get past test 11, but the final return will only give the string regardless of what values are picked for name, str, int, or cha.

I tried running this with changed values, but I kept getting the character sheet for ren with 4 str, 2 int, and 1 cha. I think if you adjust the final return line to account for any inputs that satisfy the validation steps, then you’ll get past test 12.

1 Like

That absolutely worked! Thanks a million! This is the final code below……

code removed by moderator to avoid spoilers

no, you can always go where you want in the curriculum

1 Like

ahhh ok! noted! Thanks for the insight.

I still don’t get it.

Please create your own topic:

If you have a question or need some help about a specific challenge as it relates to your written code for that challenge, please click the Get Help > Ask for Help button, which is displayed on the challenge after you have attempted to submit your solution at least three times.

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.