Build an RPG Character - Build an RPG Character

Tell us what’s happening:

#my code produces the correct output so when can I go further
I see some people have submitted their own code but doesn’t fit mine???

Your code so far

full_dot = '●'
empty_dot = '○'

def show_dots(nmbr):
    astr = full_dot * nmbr + empty_dot * ( 10 - nmbr)
    return astr

def create_character(name, strength, intelligence, carisma):
	if type(name) is not str:
		print("The character name should be a string.")
		return False

	if len(name)<1 :
		print("The character should have a name.")
		return False
	
	if(len(name)>10):
		print("The character name is too long.")
		return False
		
	if(name.count(' ')>0):
		print("The character name should not contain spaces.")
		return False
# all stats must be integer	
	if((type(strength) != int) or 
		(type(intelligence) != int) or 
		(type(carisma) != int) ):
		print("All stats should be integers.")
		return False
# all stats must > 1 	
	if((strength <1) or (intelligence<1) or (carisma<1) ):
		print("All stats should be no less than 1.")
		return False
 
# All stats should be no more than 4.'
	if((strength >4) or (intelligence >4) or (carisma>4) ):
		print("All stats should be no more than 4.")
		return False
# If the sum of all stats is different than 7, 
	if strength + intelligence + carisma != 7:
		print("The character should start with 7 points.")
		return False
	print(name)
	print("STR "+ show_dots(strength))
	print("INT "+ show_dots(intelligence))
	print("CAR "+ show_dots(carisma))
#

create_character('ren', 4, 2, 1)


Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0

Challenge Information:

Build an RPG Character - Build an RPG Character

Welcome to the forum @erikvand45

Try removing the period at the end of the string.

You are asked to return, not print.

Happy coding

Tell us what’s happening:

All test work as asked for however they dont get ticked! Why? Do I need to reset the lesson, I have filecopy of the program

Your code so far

full_dot = '●'
empty_dot = '○'

def show_dots(nmbr):
    astr = full_dot * nmbr + empty_dot * ( 10 - nmbr)
    return astr

def create_character(name, strength, intelligence, carisma):
	if type(name) is not str:
		print("The character name should be a string.")
		return False

	if len(name)<1 :
		print("The character should have a name.")
		return False
	
	if(len(name)>10):
		print("The character name is too long.")
		return False
		
	if(name.count(' ')>0):
		print("The character name should not contain spaces.")
		return False
# all stats must be integer	
	if((type(strength) != int) or 
		(type(intelligence) != int) or 
		(type(carisma) != int) ):
		print("All stats should be integers.")
		return False
# all stats must > 1 	
	if((strength <1) or (intelligence<1) or (carisma<1) ):
		print("All stats should be no less than 1.")
		return False
 
# All stats should be no more than 4.'
	if((strength >4) or (intelligence >4) or (carisma>4) ):
		print("All stats should be no more than 4.")
		return False
# If the sum of all stats is different than 7, 
	if strength + intelligence + carisma != 7:
		print("The character should start with 7 points.")
		return False
	print(name)
	print("STR "+ show_dots(strength))
	print("INT "+ show_dots(intelligence))
	print("CAR "+ show_dots(carisma))
#

create_character('ren', 4, 2, 1)

create_character(20,3,4,5)
create_character("",2,3,4)
create_character("thunderbolt",2,3,4)
create_character("thunde   r",2,3,4)
create_character("thunde",2,"bla",4)
create_character("thunde",0,3,4)
create_character("thunde",5,3,4)
create_character("thunde",1,3,4)

Your browser information:

User Agent is: Mozilla/5.0 (X11; Linux x86_64; rv:140.0) Gecko/20100101 Firefox/140.0

Challenge Information:

Build an RPG Character - Build an RPG Character

are you sure that your function is returning what you are asked to return?

I have merged your two topics, please do not create multiple topics for the same challenge

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.