Tell us what’s happening:
I need help checking my code. I thought that this would pass after I have been working on it over the past couple of hours. I tried it with input parameters and it was working. Can anyone help me with where I have gone wrong. This is showing as wrong on almost every step although it gives the correct output from what I have tested.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(character_name, strength, intelligence, charisma):
if not type(character_name == str):
return(print('The character name should be a string'))
if character_name == '':
return(print('The character should have a name'))
if ' ' in character_name:
return(print('The character name should not contain spaces'))
if len(character_name) > 10:
return(print('The character name is too long'))
return(character_name)
stats = [int(strength), int(intelligence), int(charisma)]
if type(stats) == int:
return(print('All stats should be integers'))
if strength < 1 or intelligence < 1 or charisma < 1:
return(print('All stats should be no less than 1'))
if strength > 4 or intelligence > 4 or charisma > 4:
return(print('All stats should be no more than 4'))
if strength + intelligence + charisma != 7:
return(print('The character should start with 7 points'))
return(stats)
strength = full_dot * strength + empty_dot * (10 - strength)
intelligence = full_dot * intelligence + empty_dot * (10 - intelligence)
charisma = full_dot * charisma + empty_dot * (10 - charisma)
return(print(f'''{character_name}
STR: {strength}
INT: {intelligence}
CHA: {charisma}'''))
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