Tell us what’s happening:
for some reason i can´t geti it right the 5 and 7 step
i have tried if my_valid_stats >= 7: im seeing the change but i´m too stuborn to undertand, can someone give me a hint
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(chr_name, strength, intelligence, charisma):
if not isinstance(chr_name, str):
return 'The character name should be a string'
if len(chr_name) > 10:
return 'The character name is too long'
if ' ' in chr_name:
return 'The character name should not contain spaces'
sum_stats = {'STR':strength, 'INT':intelligence, 'CHA':charisma}
for my_valid_stats in sum_stats.values():
if not isinstance(my_valid_stats, int):
return 'All stats should be integers'
if my_valid_stats < 1:
return 'All stats should be no less than 1'
if my_valid_stats > 4:
return 'All stats should be no more than 4'
if sum(sum_stats.values()) != 7:
return 'The character should start with 7 points'
character_string = chr_name
for key, my_valid_stats in sum_stats.items():
character_string += f'\n{key} {full_dot*my_valid_stats}{empty_dot*(10-my_valid_stats)}'
return character_string
print(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/142.0.0.0 Safari/537.36
Challenge Information:
Build an RPG character - Build an RPG Character