Tell us what’s happening:
My code functions correctly and as intended, however, for some reason, I keep getting step 11 as wrong, I decided to just return the exact text from step 11 in my code and that worked, even tho it doesnt take into account any parameter/arguments. And when it comes to step 12, I dont even understand what its asking me to do.
Your code so far
def create_character(character_name, strenght,intelligence,charisma):
if not isinstance(character_name, str):
return'The character name should be a string'
elif len(character_name)>10:
return "The character name is too long"
elif len(character_name)<1:
return'The character should have a name'
elif character_name.find(' ')>0:
return'The character name should not contain spaces'
elif not isinstance(strenght, int) or not isinstance(intelligence, int) or not isinstance(charisma, int):
return ('All stats should be integers')
elif strenght<1 or intelligence<1 or charisma<1:
return('All stats should be no less than 1')
elif strenght>4 or intelligence>4 or charisma>4:
return('All stats should be no more than 4')
elif not strenght +intelligence +charisma == 7:
return('The character should start with 7 points')
else:
str_full_dot = '●'*strenght
str_empty_dot = '○'*(10-strenght)
strenght_dot= str_full_dot + str_empty_dot
int_full_dot = '●'*intelligence
int_empty_dot = '○'*(10-intelligence)
intelligence_dot= int_full_dot + int_empty_dot
cha_full_dot = '●'*charisma
cha_empty_dot = '○'*(10-charisma)
charisma_dot= cha_full_dot + cha_empty_dot
return f'{character_name}\nSTR {strenght_dot} \nINT {intelligence_dot}\nCHA {charisma_dot}'
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/141.0.0.0 Safari/537.36 OPR/125.0.0.0
Challenge Information:
Build an RPG Character - Build an RPG Character