Tell us what’s happening:
I am a bit lost to get the code for the stats right - as far as I got atm . With my code I get the return “All stats should be integers” and I don’t know how to tackle the problem properly. In the forum I saw that other people used code which was not introduced in the course yet (like ‘for’, ‘any’ or ‘all’) or did I overlooked someting? Is this necessary or is it possible to solve the task with the given tools?
Thanks a lot in advance!
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, stre, inte, cha):
if not isinstance(name, str):
return "The character name should be a string"
if name.isspace() == True:
return "The character should have a name"
if len(name) > 10:
return "The character name is too long"
if " " in name:
return "The character name should not contain spaces"
int_stats = [stre, inte, cha]
if not isinstance((stre,inte,cha), int):
return "All stats should be integers"
if stre < 1 or inte < 1 or cha < 1:
return "All stats should be no less than 1"
if stre > 4 or inte > 4 or cha > 4:
return "All stats should be no more than 4"
if sum(stre, inte, cha) != 7:
return "All sats should start with 7 points"
print(create_character('rer', 4, 2, 1))
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:140.0) Gecko/20100101 Firefox/140.0
Challenge Information:
Build an RPG Character - Build an RPG Character