Tell us what’s happening:
Hello,
I cannot get passed step 6 and above. And the console keeps printing “All stats should be integers” despite my stats all being integer when I call the function. I don’t understand.
I have been struggling for over a week on this overall exercice. I had to finish the next chapter (loops and sequences) to have the necessary knowledge to do the loops part. I think I’m nearly there but I don’t understand why I’m stuck T_T
Thanks
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(character_name, strenght, intelligence, charisma):
if not isinstance(character_name, str):
return "The character name should be a string";
if len(character_name) > 10:
return "The character name is too long";
if ' ' in character_name:
return "The character name should not contain spaces";
else:
pass;
stats = {'STR': strenght, 'INT': intelligence, 'CHA': charisma};
stat = list(stats.values())
for stat in stats:
if not isinstance(stat, int):
return "All stats should be integers";
if stat < 1:
return "All stats should be no less than 1";
if stat > 4:
return "All stats should be no more than 4";
if sum(stats.values) != 7:
return "The character should start with 7 points";
else:
pass
return character_name
for key in stats:
character_stat_visual = f"{key} {full_dot * stat}{empty_dot * 10 - stat}\n";
return character_stat_visual
print(create_character("aaabbbcccd", 4, 2, 1))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:144.0) Gecko/20100101 Firefox/144.0
Challenge Information:
Build an RPG character - Build an RPG Character
https://www.freecodecamp.org/learn/full-stack-developer/lab-rpg-character/build-an-rpg-character