I am stuck on question 8 and have somehow managed to complete various different tasks..
1,2,3,5,6,7, 9, 11, 13,15
but yet I am stuck on for example 8, 10, 12 and 14. I am not sure how the verification works.. Not sure if the code tools I need are found in the previous chapters of the Python curriculum.
Your code so far
full_dot = '●'
empty_dot = '○'
def create_character(name, strenght, intelligence, charisma):
#namevalidation
if not isinstance(name,str):
return "The character name should be a string"
if name == "":
return "The character should have a name"
if len(name) >10:
return "The character name is too long"
if not len(name) >10:
return
if ' ' in name:
return 'The character name should not contain spaces.'
elif not name.find (" "):
return
my_character = create_character("Ray ray", 2, 3, 5)
(my_character)
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/151.0.0.0 Safari/537.36
No I fixed it now I am on number 10 and trying to figure that one out.
Could it be so that the “else” part cuts away the code that is writen after?
def create_character(name, strenght, intelligence, charisma):
#namevalidation
if not isinstance(name,str):
return "The character name should be a string"
#checks for empty strings
if name == '':
return "The character should have a name"
#checks for number of signs in a string
if (len(name)) > 10:
return "The character name is too long"
#checks for spaces in name
if " " in name:
return "The character name should not contain spaces"
else:
return
if not int in strenght or intelligence or charisma:
return "All stats should be integers"
if not isinstance(strenght, int) < 1 and not isinstance(intelligence, int) <1 and not isinstance(charisma, int) <1:
return "All stats should be no less than 1"