I cannot figure why step 10 won’t pass. When I replace one of the arguments with a string, it says “All stats should be integers” so I’m not sure why it isn’t being accepted.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(character_name,strength,intelligence,charisma):
if not isinstance(character_name,str):
return('The character name should be a string')
elif character_name=='':
return('The character should have a name')
elif len(character_name)>10:
return('The character name is too long')
elif character_name.find(' ')>1:
return('The character name should not contain spaces')
elif not isinstance(strength or intelligence or charisma,int):
return('All stats should be integers')
elif 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 not (strength+intelligence+charisma)==7:
return('The character should start with 7 points')
else:
return 'ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○'
step18= 'ren\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○'
hi=create_character('ren',4,2,1)
print(hi)
Your browser information:
User Agent is: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/148.0.0.0 Safari/537.36
I’m mildly confused on this. I changed my current function to accept any name. Now ‘stimpy’ prints ‘stimpy’ and not ren and if I do ‘stim’ it prints stim. However, step 10 still isn’t passing as valid. Is there something else I’m missing?
full_dot = '●'
empty_dot = '○'
def create_character(character_name,strength,intelligence,charisma):
if not isinstance(character_name,str):
return('The character name should be a string')
elif character_name=='':
return('The character should have a name')
elif len(character_name)>10:
return('The character name is too long')
elif character_name.find(' ')>1:
return('The character name should not contain spaces')
elif not isinstance(strength or intelligence or charisma,int):
return('All stats should be integers')
elif 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 not (strength+intelligence+charisma)==7:
return('The character should start with 7 points')
else:
return f'{character_name}\nSTR ●●●●○○○○○○\nINT ●●○○○○○○○○\nCHA ●○○○○○○○○○'
print(create_character('ren',4,2,1))
Oh shoot. Ok, nice, I got step 19 complete. That felt nice to get complete. Again though, what am I doing wrong for step 10?
full_dot = '●'
empty_dot = '○'
def create_character(character_name,strength,intelligence,charisma):
if not isinstance(character_name,str):
return('The character name should be a string')
elif character_name=='':
return('The character should have a name')
elif len(character_name)>10:
return('The character name is too long')
elif character_name.find(' ')>1:
return('The character name should not contain spaces')
elif not isinstance(strength or intelligence or charisma,int):
return('All stats should be integers')
elif 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 not (strength+intelligence+charisma)==7:
return('The character should start with 7 points')
else:
strbar='●'*strength+('○'*(10-strength))
intbar='●'*intelligence+('○'*(10-intelligence))
chabar='●'*charisma+('○'*(10-charisma))
#+○*{10-strength}
return f'{character_name}\nSTR {strbar}\nINT {intbar}\nCHA {chabar}'
print(create_character('ren',1,2,4))
I looked through some more forum posts to see if I could figure it out and I figured my formatting was weird for step 10 on line 13. I appreciate the help and without you, I wouldn’t have figured out what the issue was with step 19.