Tell us what’s happening:
I’m trying to validate that the strength, intelligence and charisma variables are all integers. I’m not sure what I’m doing wrong
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
#1 validate that the name is a string
if not isinstance(name, str):
return "The character name should be a string"
#2 validate that the name is not empty
if name == "":
return "The character should have a name"
#3 validate that the name is no longer than 10 characters
if len(name) > 10:
return "The character name is too long"
#4. validate that the name does not contain spaces
if "" in name:
return "The character name should not contain spaces"
#5 validate if the stats are integers
if not isinstance(strength, int) or not isinstance(intelligence, int) or not isinstance(charisma, int):
return "All stats should be integers"
Your browser information:
User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/145.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character