Tell us what’s happening:
I can’t figure out what is wrong here, can anyone help? I know there is a more concise way to do it but can anyone else help me figure out where I’m going wrong? Particularly with number 7 and 8 I don’t see why this is not working.
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"
if len(character_name) > 10:
return "The character name is too long"
if character_name.count(" ") > 0:
return "The character name should not contain spaces"
if not isinstance(strength, int) or not isinstance(intelligence, int) or not isinstance(charisma, int):
return "All stats should be integers"
if strength or intelligence or charisma < 1:
return "All stats should be no less than 1"
if strength or intelligence or charisma >4:
return "All stats should be no more than 4"
if sum(strength, intelligence, charisma) !=7:
return "The character should start with 7 points"
else:
return character_name
return "STR" + " " + full_dot * strength + empty_dot * 10 - full_dot * strength
return "INT" + " " + full_dot * intelligence + empty_dot * 10 - full_dot * intelligence
return "CHA" + " " + full_dot * charisma + empty_dot * 10 - full_dot * charisma
print(create_character("ren", 4, 2, 1))
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:142.0) Gecko/20100101 Firefox/142.0
Challenge Information:
Build an RPG character - Build an RPG Character