Tell us what’s happening:
I am getting stuck on this particular part:
10.When create_character is called with a second, third or fourth argument that is not an integer it should return All stats should be integers.
I have read through other posts. Not sure if there is something wrong with my code for ‘The character name should not contain spaces’ which is affecting the rest of my code. OR is there something wrong with how I am trying to check for an integer.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
#NameCheck
if not isinstance(name, str):
return 'The character name should be a string'
elif name == '':
return 'The character should have a name'
elif len(name) > 10:
return 'The character name is too long'
elif ' ' in name:
return 'The character name should not contain spaces'
else:
return name
#StatCheck
stats = {strength, intelligence, charisma}
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) != 7:
return 'The character should start with 7 points'
else:
pass
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Safari/605.1.15
Challenge Information:
Build an RPG Character - Build an RPG Character