Can someone help me? It appears I am at a standpoint. I answer one part of the requirements and another part becomes bad. For example number 2 and 3 of the requirements appear to be opposites sides of the same coin but if I answer number two number three is now wrong and if I answer number 3 than number 2 will be wrong. Those are not the only ones that are doing that. Almost every other requirement is wrong on my checklist. Can anybody help me please?
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strength, intelligence, charisma):
if not isinstance (name, str):
return 'The character name should be a string.' #output name should be a string
if len(name) > 10:
return 'The character name is too long.' #output name is too long
if '' in name:
return 'The character name should not contain spaces.'#output no spaces
stat= {'STR': Strength, 'INT': Intelligence, 'CHA': Charisma}
for stat in stats.value():
if not isinstance (stat, int):
return('All stats should be integers.') #output need stats
for stat in stats.value():
if stat < 1:
return ('All stats should be no less than 1.')#output Stats 1 or more
for stat in stats.value():
if stat > 4:
return 'All stats should be no more than 4.' #output No more than 4
if sum(stats.value()) != 7:
return 'The character should start with 7 points.'
print(create_character)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/152.0.0.0 Safari/537.36
if not isinstance (name, str):
return 'The character name should be a string.' #output name should be a string
if len(name) > 10:
return 'The character name is too long.' #output name is too long
if '' in name:
return 'The character name should not contain spaces.'#output no spaces
stat= {'STR': Strength, 'INT': Intelligence, 'CHA': Charisma}
for stat in stats.value():
if not isinstance (stat, int):
return('All stats should be integers.') #output need stats
for stat in stats.value():
if stat < 1:
return ('All stats should be no less than 1.')#output Stats 1 or more
for stat in stats.value():
if stat > 4:
return 'All stats should be no more than 4.' #output No more than 4
if sum(stats.value()) != 7:
return 'The character should start with 7 points.'
There are two ways you can format your code to make it easier to read and test:
After you copy/paste your code into the editor, select it by dragging your cursor over it then click the (</>) button in the toolbar to automatically wrap your code in backticks. (You can click on the animated demo image below to enlarge it.)
Manually add three backticks on a new line above your code and on a new line after your code. Note that a backtick is NOT the same as a single quote('). To find the backtick key on your keyboard, see this post.
To see changes to your post as you make them, you can click the (M+) button on the toolbar to bring up the rich text editor: