Tell us what’s happening:
Why is my code wrong when it gave all the required outputs
full_dot = ‘●’
empty_dot = ‘○’
def create_character(name,STR,INT,CHA):
if type(name) != str:
print(“The character name should be a string”)
elif name == “”:
print(“The character should have a name”)
elif len(name) > 10:
print(“The character name is too long”)
elif " " in name == True:
print(“The character name should not contain spaces”)
else:
if type(STR) != int or type(INT) !
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name,STR,INT,CHA):
if type(name) != str:
print("The character name should be a string")
elif name == "":
print("The character should have a name")
elif len(name) > 10:
print("The character name is too long")
elif " " in name == True:
print("The character name should not contain spaces")
else:
if type(STR) != int or type(INT) != int or type(CHA) != int:
print("All stats should be integers")
elif STR <1 or INT <1 or CHA <1:
print("All stats should be no less than 1")
elif STR >4 or INT >4 or CHA >4:
print("All stats should be no more than 4")
elif STR + INT + CHA != 7:
print("The character should start with 7 points")
else:
STR = "STR "+ full_dot*STR + empty_dot*(10-STR)
INT = "INT "+ full_dot*INT + empty_dot*(10-INT)
CHA = "CHA "+ full_dot*CHA + empty_dot*(10-CHA)
character = name + "\n" + STR + "\n" + INT + "\n" + CHA
return character
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36
Challenge Information:
Build an RPG Character - Build an RPG Character