Tell us what’s happening:
Describe your issue in detail here.
Hello. I really don’t know what is the problem. I do lots of trial but my program is stuck in the second validation. Anybody can give me a clue? (Sorry if my english is bad)
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intel, cha):
if not isinstance (name, str):
return 'The character name should be a string'
elif isinstance (name, str):
return name
elif name == '':
return 'The character should have a name'
elif not name == '':
return name
elif len(name) > 10:
return 'The character name is too long'
elif ' ' in name:
return 'The character name should not contain spaces'
elif not instance(strength, int) or not isinstance(intel, int) or not isinstance(cha, int):
return 'All stats should be integers'
elif strength < 1 or intel < 1 or cha < 1:
return 'All stats should be no less than 1'
elif strengrh > 4 or intel > 4 or cha > 4:
return 'All stats should be no more than 4'
elif not (strength + intel + char == 7):
return 'The character should start with 7 points'
else:
return f'{name} \n STR {full_dot*strength}{empty_dott*(10-strength)} \n INT {full_dot*intel}{empty_dot*(10-intel)} \n CHA {full_dot*char}{empty_dot*(10-char)}'
print(create_character('ren', 4, 2, 1))
Your mobile information:
2512BPNDAG - Android 17 - Android SDK 37
Challenge: Build an RPG Character - Build an RPG Character
Link to the challenge: