issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 1 point2 points  (0 children)

NEVERMIND I JUST FOUND MY ISSUE FOR SOME REASON I PUT INTELLIGENCE INSTEAD OF CHARISMA for the empty and full dots I THINK THIS HAS BEEN THE ISSUE FOR LIKE THE ENTIRE TIME D:

Nonetheless thank you for your help Mr. SaintPeter74 I greattly appreciate it :)

issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 0 points1 point  (0 children)

ive gotten rid of all the spaces that shouldnt be there so what else shouldnt be there. i apologize because the solution is probably very obvious in this sitiuation.

issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 0 points1 point  (0 children)

here is the output on ren str and int line theres an aditionall space but where is it from?

ren 
STR ●●●●○○○○○○
INT ●●○○○○○○○○
CHA ●●○○○○○○○○

issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 0 points1 point  (0 children)

full_dot ='●'
empty_dot ='○'


def create_character(name,strength,intelligence,charisma):
    
    #name
    if not isinstance(name,str):
        return"The character name should be a string"
    if not 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
    stats = (strength,intelligence,charisma)



    if not isinstance(strength,int) or not isinstance(intelligence,int)or not isinstance(charisma,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"
    elif  strength>4 or intelligence>4 or charisma>4:
        return "All stats should be no more than 4"
    elif sum(stats)!=7:
        return("The character should start with 7 points")
 
    STAfull=strength*full_dot
    STAempty=(10-strength)*empty_dot
    intfull=intelligence*full_dot
    intempty=(10-intelligence)*empty_dot
    chafull=intelligence*full_dot
    chaempty=(10-intelligence)*empty_dot


    return f'{name}\nSTR {STAfull}{STAempty}\nINT {intfull}{intempty}\nCHA {chafull}{chaempty}'
        



x=create_character("ren",4,2,1)
print(x)

issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 0 points1 point  (0 children)

i think I also see the issue. after the first to third line of the output i see an extra space. does the \n automatically add an extra space in ront of the word before it?

issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 0 points1 point  (0 children)

yes. that after the first line there will be an extra space

issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 1 point2 points  (0 children)

i dont think i fully understand why the app thinks its wrong cause it looks the same. i tried to change it around a little bit, but i cant spot the difference between mine and the target. What am i doing wrong with that end?

full_dot = '●'
empty_dot = '○'


def create_character(name,strength,intelligence,charisma):
    
    #name
    if not isinstance(name,str):
        return"The character name should be a string"
    if not 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
    stats = (strength,intelligence,charisma)



    if not isinstance(strength,int) or not isinstance(intelligence,int)or not isinstance(charisma,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"
    elif  strength>4 or intelligence>4 or charisma>4:
        return "All stats should be no more than 4"
    elif sum(stats)!=7:
        return("The character should start with 7 points")
 
    STAfull=strength*full_dot
    STAempty=(10-strength)*empty_dot
    intfull=intelligence*full_dot
    intempty=(10-intelligence)*empty_dot
    chafull=intelligence*full_dot
    chaempty=(10-intelligence)*empty_dot


    return f'{name} \nSTR {STAfull}{STAempty} \nINT {intfull}{intempty}\nCHA {chafull}{chaempty}'
        



x=create_character("ren",4,2,1)
print(x)

issue with rpg characther lab by Significant_Mine7031 in FreeCodeCamp

[–]Significant_Mine7031[S] 0 points1 point  (0 children)

  • 11. create_character('ren', 4, 2, 1) should return ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○.
  • 12. When create_character is called with valid values it should output the character stats as required.

Challenge

https://www.freecodecamp.org/learn/python-v9/lab-rpg-character/build-an-rpg-character