Build an RPG character - Build an RPG Character

Tell us what’s happening:

I had a pass up to validating stats and could not move and ended up restarting because I deleted the beginning, so I reset and was confident I would pass forward.
I am now at the very beginning. What am I doing wrong? Console says indentation error. I had broken up the arguments into two lines and indented properly, then I kept getting syntax error.

Your code so far

full_dot = '●'
empty_dot = '○'
def create_character(
    name,
    strength,
    intelligence,
    charisma):


    
    

         

        
    

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0

Challenge Information:

Build an RPG character - Build an RPG Character

Traceback (most recent call last):
  File "main.py", line 7
    charisma):
              ^
IndentationError: expected an indented block after function definition on line 3

There is nothing in your function so you are getting an error. There’s no code, so there’s not indent.

Please review this: https://www.geeksforgeeks.org/python/python-pass-statement/

The pass keyword in a function is used when we define a function but don’t want to implement its logic immediately. It allows the function to be syntactically valid, even though it doesn’t perform any actions yet.

Thank you. I will be sure to carefully read the attached and all is well in the console now and the first task is completed.

1 Like

Tell us what’s happening:

So far the console does not show any mishaps, but my attempt passed only the first test.

Your code so far

full_dot = '●'
empty_dot = '○'
def create_character(
    name,
    strength,
    intelligence,
    charisma):
    pass
def create_character():
    if not isinstance(name, int):
       return "The character name should be a string"
    if len (name)>=10:
       return "The character name is too long"
    if ''in name:
       return "The character name should not contain spaces"
       
             

        
    

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:145.0) Gecko/20100101 Firefox/145.0

Challenge Information:

Build an RPG character - Build an RPG Character

you have two functions of the same name, are you sure that is correct?

I added the second one later, I just removed it. Still does not pass.

what is your code now?

The code is the same with the second function removed. Console fine, test only the first one passes.

Please share your code, because doing what you say, removing the second function, means now the function only includes pass

Depending on what exactly you removed, does this code look correct?

Below is the entire code:

full_dot = '●'

empty_dot = '○'

def create_character(

    name,

    strength,

    intelligence,

    charisma):

    pass

    if not isinstance(name,int):

       return"The character name should be a string"

    if len (name)>=10:

       return"The character name is too long"

    if ''in name:

       return"The character name should not contain spaces"

I’ve edited your post to improve the readability of the code. When you enter a code block into a forum post, please precede it with three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add the backticks.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

are you sure this is the type checking you want to do?

pass does not hurt but maybe you want to remove it

are you sure?

why are you checking if there is an empty string in name?

Thanks, I applied your edit and all passed. I found a key for the uptick, to use as needed. I did not need it now.

Tell us what’s happening:

There is no alert in the console, but the test does not pass at this point.

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 len (name)>10:
       return"The character name is too long"
    if ''in (name):
       return"The character name should not contain spaces" 
    stats={'STR':strength,
     'INT':intelligence, 
     'CHA':charisma}
    for stats in stat.value():
      if not isinstance(stat,int):       return"All stats should be integers"
       
       


    
      




 
             

        
    

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:146.0) Gecko/20100101 Firefox/146.0

Challenge Information:

Build an RPG character - Build an RPG Character

which test are you asking about?

I have merged your three topics on the RPG Character project, please do not create multiple topics for the same challenge

add a print

print(create_character("al", '',3,4))

see what your function does, make sure it does the right thing

This print (create_character(“al” ,‘’, 2,3,4))

   did not pass .Please help.

do you see what your function is returning for this case? create_character("al", '',3,4)
look at the terminal, what it’s written there? where does that come from? which line(s) cause that message to be printed?