Build an RPG Character - Build an RPG Character

Tell us what’s happening:

im really confused on how to do step 11 on how to print the stats with the dots

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"
    if type(strength) is not int or type(intelligence) is not int or type(charisma) is not int:
        return 'All stats should be integers'
            
        
    if strength < 1 or intelligence < 1 or charisma < 1:
        return 'All stats should be no less than 1'
    if strength > 4 or intelligence > 4 or charisma > 4:
        return 'All stats should be no more than 4'
    if strength + intelligence + charisma != 7:
        return "The character should start with 7 points"
    
    
create_character('ren', 4,2,1)
   
        
    



    



Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36

Challenge Information:

Build an RPG Character - Build an RPG Character

When you call the function with this data, the function parameters take those values, so name is “ren”, strength is 4, intelligence is 2, and charisma is 1.

Use those parameters to build the requested string: ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.

Start simply by building this piece: ren\nSTR , then use the global variables provided to make the correct number of filled dots based on the value of strength. Then add the remaining empty dots. Etc.

Your function should return the string you build.

i still didnt understand how to start building it

you need to create a string that has that format, 4 lines with the first line for the name and the other three with the three letter abbreviation of the stat and the dots to rapresent how many points on the stat

You know how to concatenate variables and strings, right?

like this
stat_str = ‘ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○’

It looks like you are just hard coding the expected string. You should use the function parameters to determine the values used in the string. The way it is, your function will always return the same thing no matter what values are passed to it.

I mean, what if I call your function like this: create_character('godzilla',3,2,2)?

i really dont understand like how to use the function parameters to determine the values of the string

If you are looking for someone to just hand you the solution, that is not going to happen.

At this point in your learning, you should be able to concatenate variables and strings.

Perhaps go back and review some of the lectures like this one:
Introduction to Strings - What Are String Concatenation and String Interpolation? | Learn | freeCodeCamp.org

if i was looking for the solution instantly i was going to ask chatgpt but i came here to ask for help and i didnt expect this answer from you?!

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.